Commit e1e832f5 authored by Luis Javier Merino's avatar Luis Javier Merino Committed by Kurt Hindenburg
Browse files

Don't clear line rendition on EL and partial ED

EL (Erase Line) should not reset the line rendition attribute to
single-width. ED (Erase Display) should only reset it for completely
cleared lines. ECH (Erase CHaracters) should obviously not reset it.
DECSED and DECSEL (Selective Erase, not supported by Konsole) should not
reset it.

This fixes a vttest test where a line is set to double-height-top and
then EL before writing its text and the double-height-bottom line below.

Can also be tested with:

echo -e "\e[2J\e[4;1HNormal\n\e#6DOUBLE\n\e#6DOUBLE\nNormal" &&
sleep 2; echo -e "\e[5;3H\e[1J\e[8;1H"
parent 4352df00
......@@ -224,7 +224,7 @@ void Screen::eraseChars(int n)
n = MAX_SCREEN_ARGUMENT;
}
const int p = qBound(0, _cuX + n - 1, _columns - 1);
clearImage(loc(_cuX, _cuY), loc(p, _cuY), ' ');
clearImage(loc(_cuX, _cuY), loc(p, _cuY), ' ', false);
}
void Screen::deleteChars(int n)
......@@ -1078,7 +1078,7 @@ int Screen::getCursorY() const
return _cuY;
}
void Screen::clearImage(int loca, int loce, char c)
void Screen::clearImage(int loca, int loce, char c, bool resetLineRendition)
{
const int scr_TL = loc(0, _history->getLines());
//FIXME: check positions
......@@ -1098,7 +1098,7 @@ void Screen::clearImage(int loca, int loce, char c)
const bool isDefaultCh = (clearCh == Screen::DefaultChar);
for (int y = topLine; y <= bottomLine; y++) {
_lineProperties[y] = 0;
_lineProperties[y] &= ~LINE_WRAPPED;
const int endCol = (y == bottomLine) ? loce % _columns : _columns - 1;
const int startCol = (y == topLine) ? loca % _columns : 0;
......@@ -1116,6 +1116,10 @@ void Screen::clearImage(int loca, int loce, char c)
std::fill(line.begin() + startCol, line.begin() + (endCol + 1), clearCh);
}
}
if (resetLineRendition && startCol == 0 && endCol == _columns - 1) {
_lineProperties[y] &= ~(LINE_DOUBLEWIDTH | LINE_DOUBLEHEIGHT);
}
}
}
......@@ -1216,17 +1220,17 @@ void Screen::helpAlign()
void Screen::clearToEndOfLine()
{
clearImage(loc(_cuX, _cuY), loc(_columns - 1, _cuY), ' ');
clearImage(loc(_cuX, _cuY), loc(_columns - 1, _cuY), ' ', false);
}
void Screen::clearToBeginOfLine()
{
clearImage(loc(0, _cuY), loc(_cuX, _cuY), ' ');
clearImage(loc(0, _cuY), loc(_cuX, _cuY), ' ', false);
}
void Screen::clearEntireLine()
{
clearImage(loc(0, _cuY), loc(_columns - 1, _cuY), ' ');
clearImage(loc(0, _cuY), loc(_columns - 1, _cuY), ' ', false);
}
void Screen::setRendition(RenditionFlags rendition)
......
......@@ -617,7 +617,8 @@ private:
//fills a section of the screen image with the character 'c'
//the parameters are specified as offsets from the start of the screen image.
//the loc(x,y) macro can be used to generate these values from a column,line pair.
void clearImage(int loca, int loce, char c);
//if resetLineRendition is true, all completely cleared lines will be set to single-width.
void clearImage(int loca, int loce, char c, bool resetLineRendition = true);
//move screen image between 'sourceBegin' and 'sourceEnd' to 'dest'.
//the parameters are specified as offsets from the start of the screen image.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment