mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-05 02:05:25 +08:00
Do not limit cursor movement to scroll region
The scrolling region set by DECSTBM should not affect the Cursor Down (CUD) and Cursor Up (CUU) escape sequences. Fixes #1340.
This commit is contained in:
@@ -1376,10 +1376,10 @@ public final class TerminalEmulator {
|
||||
}
|
||||
break;
|
||||
case 'A': // "CSI${n}A" - Cursor up (CUU) ${n} rows.
|
||||
setCursorRow(Math.max(mTopMargin, mCursorRow - getArg0(1)));
|
||||
setCursorRow(Math.max(0, mCursorRow - getArg0(1)));
|
||||
break;
|
||||
case 'B': // "CSI${n}B" - Cursor down (CUD) ${n} rows.
|
||||
setCursorRow(Math.min(mBottomMargin - 1, mCursorRow + getArg0(1)));
|
||||
setCursorRow(Math.min(mRows - 1, mCursorRow + getArg0(1)));
|
||||
break;
|
||||
case 'C': // "CSI${n}C" - Cursor forward (CUF).
|
||||
case 'a': // "CSI${n}a" - Horizontal position relative (HPR). From ISO-6428/ECMA-48.
|
||||
|
@@ -107,4 +107,24 @@ public class ScrollRegionTest extends TerminalTestCase {
|
||||
assertLinesAre("1 ", "2 ", "3 ", "QQ", "YY");
|
||||
}
|
||||
|
||||
/** See https://github.com/termux/termux-app/issues/1340 */
|
||||
public void testScrollRegionDoesNotLimitCursorMovement() {
|
||||
withTerminalSized(6, 4)
|
||||
.enterString("\033[4;7r\033[3;1Haaa\033[Axxx")
|
||||
.assertLinesAre(
|
||||
" ",
|
||||
" xxx",
|
||||
"aaa ",
|
||||
" "
|
||||
);
|
||||
|
||||
withTerminalSized(6, 4)
|
||||
.enterString("\033[1;3r\033[3;1Haaa\033[Bxxx")
|
||||
.assertLinesAre(
|
||||
" ",
|
||||
" ",
|
||||
"aaa ",
|
||||
" xxx"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user