mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-08 03:24:04 +08:00
Fixed: Make ScrollDown escape respect margins
SD sequence (`${CSI}${N}T`) was scrolling the whole width of the terminal instead of just between the margins. RI sequence (`${ESC}M`, move cursor up 1 line) was doing the same. Fixed that. Fixes #2576 where in tmux scrolling one of several side-by-side panels down resulted in all visually scrolling.
This commit is contained in:
committed by
Fredrik Fornwall
parent
245158ceb9
commit
d90e3fbca1
@@ -1418,8 +1418,8 @@ public final class TerminalEmulator {
|
|||||||
// http://www.vt100.net/docs/vt100-ug/chapter3.html: "Move the active position to the same horizontal
|
// http://www.vt100.net/docs/vt100-ug/chapter3.html: "Move the active position to the same horizontal
|
||||||
// position on the preceding line. If the active position is at the top margin, a scroll down is performed".
|
// position on the preceding line. If the active position is at the top margin, a scroll down is performed".
|
||||||
if (mCursorRow <= mTopMargin) {
|
if (mCursorRow <= mTopMargin) {
|
||||||
mScreen.blockCopy(0, mTopMargin, mColumns, mBottomMargin - (mTopMargin + 1), 0, mTopMargin + 1);
|
mScreen.blockCopy(mLeftMargin, mTopMargin, mRightMargin - mLeftMargin, mBottomMargin - (mTopMargin + 1), mLeftMargin, mTopMargin + 1);
|
||||||
blockClear(0, mTopMargin, mColumns);
|
blockClear(mLeftMargin, mTopMargin, mRightMargin - mLeftMargin);
|
||||||
} else {
|
} else {
|
||||||
mCursorRow--;
|
mCursorRow--;
|
||||||
}
|
}
|
||||||
@@ -1628,8 +1628,8 @@ 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, mTopMargin + linesToScroll);
|
mScreen.blockCopy(mLeftMargin, mTopMargin, mRightMargin - mLeftMargin, linesBetweenTopAndBottomMargins - linesToScroll, mLeftMargin, mTopMargin + linesToScroll);
|
||||||
blockClear(0, mTopMargin, mColumns, linesToScroll);
|
blockClear(mLeftMargin, mTopMargin, mRightMargin - mLeftMargin, 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.
|
||||||
unimplementedSequence(b);
|
unimplementedSequence(b);
|
||||||
|
@@ -75,6 +75,16 @@ public class ScrollRegionTest extends TerminalTestCase {
|
|||||||
withTerminalSized(3, 3).enterString("\033[?69h\033[2sABC\033[?6h\033ED").assertLinesAre("ABC", " D ", " ");
|
withTerminalSized(3, 3).enterString("\033[?69h\033[2sABC\033[?6h\033ED").assertLinesAre("ABC", " D ", " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testRiRespectsLeftMargin() {
|
||||||
|
// Reverse Index (RI), ${ESC}M, should respect horizontal margins:
|
||||||
|
withTerminalSized(4, 3).enterString("ABCD\033[?69h\033[2;3s\033[?6h\033M").assertLinesAre("A D", " BC ", " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testSdRespectsLeftMargin() {
|
||||||
|
// Scroll Down (SD), ${CSI}${N}T, should respect horizontal margins:
|
||||||
|
withTerminalSized(4, 3).enterString("ABCD\033[?69h\033[2;3s\033[?6h\033[2T").assertLinesAre("A D", " ", " BC ");
|
||||||
|
}
|
||||||
|
|
||||||
public void testBackwardIndex() {
|
public void testBackwardIndex() {
|
||||||
// vttest "Menu 11.3.2: VT420 Cursor-Movement Test", test 7.
|
// vttest "Menu 11.3.2: VT420 Cursor-Movement Test", test 7.
|
||||||
// Without margins:
|
// Without margins:
|
||||||
|
Reference in New Issue
Block a user