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
Original file line number Diff line number Diff line change
Expand Up @@ -3063,14 +3063,15 @@ private void setCursorPosition(int x, int y) {
}

private void scrollDownOneLine() {
mScrollCounter++;
long currentStyle = getStyle();
if (mLeftMargin != 0 || mRightMargin != mColumns) {
// Horizontal margin: Do not put anything into scroll history, just non-margin part of screen up.
// The rows of the screen and the transcript do not move, so the scroll counter is left alone.
mScreen.blockCopy(mLeftMargin, mTopMargin + 1, mRightMargin - mLeftMargin, mBottomMargin - mTopMargin - 1, mLeftMargin, mTopMargin);
// .. and blank bottom row between margins:
mScreen.blockSet(mLeftMargin, mBottomMargin - 1, mRightMargin - mLeftMargin, 1, ' ', currentStyle);
} else {
mScrollCounter++;
mScreen.scrollDownOneLine(mTopMargin, mBottomMargin, currentStyle);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ public void testScrollRegionRight() {
enterString("\n").assertLinesAre("GHY", "IJ ", " ");
}

public void testScrollCounterCountsOnlyRowsMovedIntoTheTranscript() {
// A full width scroll moves the screen one row up in the transcript, which TerminalView follows
// through the scroll counter while text is selected:
withTerminalSized(3, 3).enterString("ABCDEFGHI\r\n").assertLinesAre("DEF", "GHI", " ").assertHistoryStartsWith("ABC");
assertEquals(1, mTerminal.getScrollCounter());
// A scroll between the left and right margins moves no row of the screen or the transcript:
withTerminalSized(3, 3).enterString("\033[?69h\033[2sABCDEFG\n").assertLinesAre("ADE", " FG", " ");
assertEquals(0, mTerminal.getScreen().getActiveTranscriptRows());
assertEquals(0, mTerminal.getScrollCounter());
}

public void testScrollRegionOnAllSides() {
// ${CSI}?69h for DECLRMM enabling, ${CSI}${LEFTMARGIN};${RIGHTMARGIN}s for DECSLRM margin setting.
withTerminalSized(4, 4).enterString("ABCDEFGHIJKLMNOP").assertLinesAre("ABCD", "EFGH", "IJKL", "MNOP");
Expand Down