Preserve current line when resetting

Reset was always called with clearScreen = true, so no point in having
that variable. We can probably also remove Screen::clear() and
Screen::home(), they're not used anymore, and weren't really useful
before this either.

We still preserve the scrollback history when resetting, which is not
what other terminal emulators do (,
but we do have a separate action for it, so I think it is a nice extra
feature to preserve it.

REVIEW: 128389
parent 1d20e43e
......@@ -513,14 +513,18 @@ QVector<LineProperty> Screen::getLineProperties(int startLine , int endLine) con
return result;
void Screen::reset(bool clearScreen)
void Screen::reset()
// Clear screen, but preserve the current line
scrollUp(0, _cuY);
_cuY = 0;
_currentModes[MODE_Origin] = false;
_savedModes[MODE_Origin] = false;
saveMode(MODE_Wrap); // wrap at end of margin
saveMode(MODE_Origin); // position refer to [1,1]
saveMode(MODE_Insert); // overstroke
......@@ -531,11 +535,11 @@ void Screen::reset(bool clearScreen)
_topMargin = 0;
_bottomMargin = _lines - 1;
// Other terminal emulators reset the entire scroll history during a reset
// setScroll(getScroll(), false);
if (clearScreen)
void Screen::clear()
......@@ -334,7 +334,7 @@ public:
* If @p clearScreen is true then the screen contents are erased entirely,
* otherwise they are unaltered.
void reset(bool clearScreen = true);
void reset();
* Displays a new character at the current cursor position.
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