summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin T. H. Sandsmark <[email protected]>2016-07-06 18:01:11 +0200
committerMartin T. H. Sandsmark <[email protected]>2016-07-08 01:15:40 +0200
commitb8e96bcdcaed71d0617eb967240c234d1aa98182 (patch)
treedd9fc385dac39761c33421ab6cd02525eff6ad85
parent1d20e43ea9ebdc977b400ff35b3d200202f0c474 (diff)
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 (http://stackoverflow.com/a/5367075), but we do have a separate action for it, so I think it is a nice extra feature to preserve it. REVIEW: 128389
-rw-r--r--src/Screen.cpp18
-rw-r--r--src/Screen.h2
2 files changed, 12 insertions, 8 deletions
diff --git a/src/Screen.cpp b/src/Screen.cpp
index 8ad4dee..ffc3fd1 100644
--- a/src/Screen.cpp
+++ b/src/Screen.cpp
@@ -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;
+
setMode(MODE_Wrap);
saveMode(MODE_Wrap); // wrap at end of margin
- resetMode(MODE_Origin);
- saveMode(MODE_Origin); // position refer to [1,1]
-
resetMode(MODE_Insert);
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);
+
setDefaultRendition();
saveCursor();
-
- if (clearScreen)
- clear();
}
void Screen::clear()
diff --git a/src/Screen.h b/src/Screen.h
index a53aa45..f73add1 100644
--- a/src/Screen.h
+++ b/src/Screen.h
@@ -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.