respect scroll margins in CUU/CUD/CPL/CNL; test files

This commit is contained in:
Jörg Breitbart
2019-08-04 12:20:44 +02:00
parent eccd6d7bdf
commit 00298531ed
6 changed files with 114 additions and 5 deletions
@@ -0,0 +1,24 @@
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x12
@@ -0,0 +1,25 @@
a
b
c
d
e
f
g
h
i
2
k
l
m
n
o
p
q
r
1
t
u
v
w
x
@@ -0,0 +1,24 @@
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x1
@@ -0,0 +1,25 @@
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
1
+16 -4
View File
@@ -616,7 +616,13 @@ export class InputHandler extends Disposable implements IInputHandler {
* Cursor Up Ps Times (default = 1) (CUU).
*/
public cursorUp(params: IParams): void {
this._moveCursor(0, -(params.params[0] || 1));
// stop at scrollTop
const diffToTop = this._bufferService.buffer.y - this._bufferService.buffer.scrollTop;
if (diffToTop >= 0) {
this._moveCursor(0, -Math.min(diffToTop, params.params[0] || 1));
} else {
this._moveCursor(0, -(params.params[0] || 1));
}
}
/**
@@ -624,7 +630,13 @@ export class InputHandler extends Disposable implements IInputHandler {
* Cursor Down Ps Times (default = 1) (CUD).
*/
public cursorDown(params: IParams): void {
this._moveCursor(0, params.params[0] || 1);
// stop at scrollBottom
const diffToBottom = this._bufferService.buffer.scrollBottom - this._bufferService.buffer.y;
if (diffToBottom >= 0) {
this._moveCursor(0, Math.min(diffToBottom, params.params[0] || 1));
} else {
this._moveCursor(0, params.params[0] || 1);
}
}
/**
@@ -649,7 +661,7 @@ export class InputHandler extends Disposable implements IInputHandler {
* Other than cursorDown (CUD) also set the cursor to first column.
*/
public cursorNextLine(params: IParams): void {
this._moveCursor(0, params.params[0] || 1);
this.cursorDown(params);
this._bufferService.buffer.x = 0;
}
@@ -659,7 +671,7 @@ export class InputHandler extends Disposable implements IInputHandler {
* Other than cursorUp (CUU) also set the cursor to first column.
*/
public cursorPrecedingLine(params: IParams): void {
this._moveCursor(0, -(params.params[0] || 1));
this.cursorUp(params);
this._bufferService.buffer.x = 0;
}
-1
View File
@@ -17,7 +17,6 @@ const ROWS = 25;
const TESTFILES = glob.sync('**/escape_sequence_files/*.in', { cwd: path.join(__dirname, '..')});
const SKIP_FILES = [
't0075-DECSTBM_CUU_CUD.in',
't0076-DECSTBM_IL_DL.in', // not working due to lineFeed
't0077-DECSTBM_quirks.in',
't0084-CBT.in',