[konsole] [Bug 456354] New text writes on top of sixel image instead of erasing part of the image

Matan Ziv-Av bugzilla_noreply at kde.org
Tue Mar 19 20:56:01 GMT 2024


https://bugs.kde.org/show_bug.cgi?id=456354

--- Comment #7 from Matan Ziv-Av <matan at svgalib.org> ---
This is far from a trivial change. This simple patch changes behaviour of sixel
images, but breaks at least kitty images, terminal background image, and
terminal background transparency.

To correctly implement this, it is needed to know at the time of drawing text
background if underneath it is a sixel image, another image, transparent
background, etc.

diff --git a/src/Screen.cpp b/src/Screen.cpp
index f5047d1f17..626292a098 100644
--- a/src/Screen.cpp
+++ b/src/Screen.cpp
@@ -2523,7 +2523,14 @@ void Screen::addPlacement(QPixmap pixmap,
     addPlacement(p);
     int needScroll = qBound(0, row + rows - _lines, rows);
     if (moveCursor && scrolling && needScroll > 0) {
-        scrollUp(needScroll);
+        if (!leaveText) {
+            for (int i = needScroll; i > 0; i--) {
+                scrollUp(1);
+                eraseBlock(_lines - 2, col, 1, cols);
+            }
+        } else {
+            scrollUp(needScroll);
+        }
     }
     if (moveCursor) {
         if (rows - needScroll - 1 > 0) {
@@ -2532,6 +2539,9 @@ void Screen::addPlacement(QPixmap pixmap,
         if (moveCursor == 2 || _cuX + cols >= _columns) {
             toStartOfLine();
             newLine();
+            if (!leaveText) {
+                eraseBlock(_lines - 2, col, rows, cols);
+            }
         } else {
             cursorRight(cols);
         }
diff --git a/src/terminalDisplay/TerminalPainter.cpp
b/src/terminalDisplay/TerminalPainter.cpp
index f19b0e6245..399b09cb2b 100644
--- a/src/terminalDisplay/TerminalPainter.cpp
+++ b/src/terminalDisplay/TerminalPainter.cpp
@@ -823,6 +823,7 @@ void TerminalPainter::drawBelowText(QPainter &painter,
                 backgroundColor = background;
             }
             drawBG = backgroundColor != colorTable[DEFAULT_BACK_COLOR];
+            drawBG = true;
             if (style[x].rendition.f.transparent) {
                 drawBG = false;
             }

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the konsole-devel mailing list