Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/Emulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ void Emulation::showBulk()

_currentScreen->resetScrolledLines();
_currentScreen->resetDroppedLines();
_currentScreen->resetResizePushedLines();
}

void Emulation::bufferedUpdate()
Expand Down
10 changes: 10 additions & 0 deletions lib/Screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Character Screen::defaultChar = Character(' ',
screenLines(new ImageLine[lines+1] ),
_scrolledLines(0),
_droppedLines(0),
_resizePushedLines(0),
history(new HistoryScrollNone()),
cuX(0), cuY(0),
currentRendition(0),
Expand Down Expand Up @@ -349,6 +350,7 @@ void Screen::resizeImage(int new_lines, int new_columns)
for (int i = 0; i < cuY-(new_lines-1); i++)
{
addHistLine(); scrollUp(0,1);
++_resizePushedLines;
}
}

Expand Down Expand Up @@ -884,6 +886,14 @@ void Screen::resetScrolledLines()
{
_scrolledLines = 0;
}
int Screen::resizePushedLines() const
{
return _resizePushedLines;
}
void Screen::resetResizePushedLines()
{
_resizePushedLines = 0;
}

void Screen::scrollUp(int n)
{
Expand Down
4 changes: 4 additions & 0 deletions lib/Screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,9 @@ class Screen
*/
void resetDroppedLines();

int resizePushedLines() const;
void resetResizePushedLines();

/**
* Fills the buffer @p dest with @p count instances of the default (ie. blank)
* Character style.
Expand Down Expand Up @@ -647,6 +650,7 @@ class Screen
QRect _lastScrolledRegion;

int _droppedLines;
int _resizePushedLines;

QVarLengthArray<LineProperty,64> lineProperties;

Expand Down
6 changes: 6 additions & 0 deletions lib/ScreenWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ void ScreenWindow::notifyOutputChanged()
_currentLine = qMax(0,_currentLine -
_screen->droppedLines());

// When the terminal shrinks, resizeImage() pushes excess screen
// lines into history to keep the cursor in view. Advance
// _currentLine by the same amount so the viewport stays
// bottom-anchored instead of jumping towards the top.
_currentLine += _screen->resizePushedLines();

// ensure that the screen window's current position does
// not go beyond the bottom of the screen
_currentLine = qMin( _currentLine , _screen->getHistLines() );
Expand Down