From fd1612ba3b8f69c9358ca908ec7965f5b3cd3267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Javier=20Merino=20Mor=C3=A1n?= Date: Tue, 9 Mar 2021 12:58:03 +0100 Subject: [PATCH] Keep track of line properties for image update Konsole wasn't really keeping track of changes to line rendition attributes, and was just always marking for update the top line of double-height lines. This didn't account for double-width lines, changes back to single-width single-height, and did not provide proper support for separate rendering of the bottom of double-height lines. The effect can be seen on vttest "Test of known bugs" (9) -> "Erase right half of double-width lines" (8), where a line is changed from single-width to double-width and back. The line wasn't re-rendered on each change, as it should. Can also be tested with: echo -e "\e[2J\e[1;1HTEST\n"; sleep 1; echo -e "\e[1;1H\e#6\e[2;1H" --- src/terminalDisplay/TerminalDisplay.cpp | 21 ++++----------------- src/terminalDisplay/TerminalDisplay.h | 5 ----- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/terminalDisplay/TerminalDisplay.cpp b/src/terminalDisplay/TerminalDisplay.cpp index 6f239df6..9808d152 100644 --- a/src/terminalDisplay/TerminalDisplay.cpp +++ b/src/terminalDisplay/TerminalDisplay.cpp @@ -118,7 +118,6 @@ void TerminalDisplay::setScreenWindow(ScreenWindow* window) _screenWindow = window; if (!_screenWindow.isNull()) { - connect(_screenWindow.data() , &Konsole::ScreenWindow::outputChanged , this , &Konsole::TerminalDisplay::updateLineProperties); connect(_screenWindow.data() , &Konsole::ScreenWindow::outputChanged , this , &Konsole::TerminalDisplay::updateImage); connect(_screenWindow.data() , &Konsole::ScreenWindow::currentResultLineChanged , this , &Konsole::TerminalDisplay::updateImage); connect(_screenWindow.data(), &Konsole::ScreenWindow::outputChanged, this, [this]() { @@ -436,7 +435,6 @@ void TerminalDisplay::scrollScreenWindow(enum ScreenWindow::RelativeScrollMode m { _screenWindow->scrollBy(mode, amount, _scrollBar->scrollFullPage()); _screenWindow->setTrackOutput(_screenWindow->atEndOfOutput()); - updateLineProperties(); updateImage(); viewScrolledByUser(); } @@ -521,6 +519,7 @@ void TerminalDisplay::updateImage() Character* const newimg = _screenWindow->getImage(); const int lines = _screenWindow->windowLines(); const int columns = _screenWindow->windowColumns(); + QVector newLineProperties = _screenWindow->getLineProperties(); _scrollBar->setScroll(_screenWindow->currentLine() , _screenWindow->lineCount()); @@ -609,12 +608,8 @@ void TerminalDisplay::updateImage() } } - //both the top and bottom halves of double height _lines must always be redrawn - //although both top and bottom halves contain the same characters, only - //the top one is actually - //drawn. - if (_lineProperties.count() > y) { - updateLine |= (_lineProperties[y] & LINE_DOUBLEHEIGHT_TOP); + if (y >= _lineProperties.count() || y >= newLineProperties.count() || _lineProperties[y] != newLineProperties[y]) { + updateLine = true; } // if the characters on the line are different in the old and the new _image @@ -636,6 +631,7 @@ void TerminalDisplay::updateImage() // current line of the new _image memcpy((void*)currentLine, (const void*)newLine, columnsToUpdate * sizeof(Character)); } + _lineProperties = newLineProperties; // if the new _image is smaller than the previous _image, then ensure that the area // outside the new _image is cleared @@ -1552,15 +1548,6 @@ void TerminalDisplay::setExpandedMode(bool expand) _headerBar->setExpandedMode(expand); } -void TerminalDisplay::updateLineProperties() -{ - if (_screenWindow.isNull()) { - return; - } - - _lineProperties = _screenWindow->getLineProperties(); -} - void TerminalDisplay::processMidButtonClick(QMouseEvent* ev) { if (!_usesMouseTracking || ((ev->modifiers() & Qt::ShiftModifier) != 0u)) { diff --git a/src/terminalDisplay/TerminalDisplay.h b/src/terminalDisplay/TerminalDisplay.h index fa1f0922..6bb88539 100644 --- a/src/terminalDisplay/TerminalDisplay.h +++ b/src/terminalDisplay/TerminalDisplay.h @@ -351,11 +351,6 @@ public Q_SLOTS: * terminal screen ( see setScreenWindow() ) and redraw the display. */ void updateImage(); - /** - * Causes the terminal display to fetch the latest line status flags from the - * associated terminal screen ( see setScreenWindow() ). - */ - void updateLineProperties(); void setAutoCopySelectedText(bool enabled);