mirror of
https://github.com/nix-community/nix-on-droid-app.git
synced 2025-12-08 18:11:10 +01:00
Fix bug with scrolling down and top scroll margin
The Termux implementation of the ${CSI}${N}T escape sequence to scroll
down N lines (SD - Pan Up) did not take the top margin into account
when figuring out where to place the scrolled rows.
Fixes #28.
This commit is contained in:
parent
ce82979e2b
commit
16273a1981
2 changed files with 5 additions and 1 deletions
|
|
@ -1444,7 +1444,7 @@ public final class TerminalEmulator {
|
||||||
final int linesToScrollArg = getArg0(1);
|
final int linesToScrollArg = getArg0(1);
|
||||||
final int linesBetweenTopAndBottomMargins = mBottomMargin - mTopMargin;
|
final int linesBetweenTopAndBottomMargins = mBottomMargin - mTopMargin;
|
||||||
final int linesToScroll = Math.min(linesBetweenTopAndBottomMargins, linesToScrollArg);
|
final int linesToScroll = Math.min(linesBetweenTopAndBottomMargins, linesToScrollArg);
|
||||||
mScreen.blockCopy(0, mTopMargin, mColumns, linesBetweenTopAndBottomMargins - linesToScroll, 0, linesToScroll);
|
mScreen.blockCopy(0, mTopMargin, mColumns, linesBetweenTopAndBottomMargins - linesToScroll, 0, mTopMargin + linesToScroll);
|
||||||
blockClear(0, mTopMargin, mColumns, linesToScroll);
|
blockClear(0, mTopMargin, mColumns, linesToScroll);
|
||||||
} else {
|
} else {
|
||||||
// "${CSI}${func};${startx};${starty};${firstrow};${lastrow}T" - initiate highlight mouse tracking.
|
// "${CSI}${func};${startx};${starty};${firstrow};${lastrow}T" - initiate highlight mouse tracking.
|
||||||
|
|
|
||||||
|
|
@ -94,4 +94,8 @@ public class ScrollRegionTest extends TerminalTestCase {
|
||||||
withTerminalSized(3, 3).enterString("\033[?69h\033[0;2sABCD\0339").assertLinesAre("B ", "D ", " ");
|
withTerminalSized(3, 3).enterString("\033[?69h\033[0;2sABCD\0339").assertLinesAre("B ", "D ", " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testScrollDownWithScrollRegion() {
|
||||||
|
withTerminalSized(2, 5).enterString("1\r\n2\r\n3\r\n4\r\n5").assertLinesAre("1 ", "2 ", "3 ", "4 ", "5 ");
|
||||||
|
enterString("\033[3r").enterString("\033[2T").assertLinesAre("1 ", "2 ", " ", " ", "3 ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue