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"
wilder
Luis Javier Merino Morán 5 years ago committed by Kurt Hindenburg
parent 05d81656f2
commit fd1612ba3b
  1. 21
      src/terminalDisplay/TerminalDisplay.cpp
  2. 5
      src/terminalDisplay/TerminalDisplay.h

@ -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<LineProperty> 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)) {

@ -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);

Loading…
Cancel
Save