Fix remembering selection in scrollback buffer

Commit d37d3ac1 "CompactHistoryScroll: Remove _maxLineCount + 5 lines at
a time" caused a regression: addHistLine queried the number of lines in
history before and after adding a line, and if it had not incremented it
assumed one line entered history and another was dropped at the other
end.  Now, lines are dropped from history in batches, so take care of
that.
This commit is contained in:
Luis Javier Merino Morán
2022-01-03 00:35:13 +01:00
committed by Kurt Hindenburg
parent 13031aa37c
commit 7a1e47686a

View File

@@ -1693,10 +1693,10 @@ void Screen::addHistLine()
bool beginIsTL = (_selBegin == _selTopLeft);
// Adjust selection for the new point of reference
if (newHistLines > oldHistLines) {
if (newHistLines != oldHistLines) {
if (_selBegin != -1) {
_selTopLeft += _columns;
_selBottomRight += _columns;
_selTopLeft += _columns * (newHistLines - oldHistLines);
_selBottomRight += _columns * (newHistLines - oldHistLines);
}
}