Get rows/cols in input hander from buffer service
This commit is contained in:
+24
-26
@@ -26,8 +26,6 @@ function getCursor(term: TestTerminal): number[] {
|
|||||||
describe('InputHandler', () => {
|
describe('InputHandler', () => {
|
||||||
describe('save and restore cursor', () => {
|
describe('save and restore cursor', () => {
|
||||||
const terminal = new MockInputHandlingTerminal();
|
const terminal = new MockInputHandlingTerminal();
|
||||||
terminal.cols = 80;
|
|
||||||
terminal.rows = 30;
|
|
||||||
terminal.curAttrData.fg = 3;
|
terminal.curAttrData.fg = 3;
|
||||||
const bufferService = new MockBufferService(80, 30);
|
const bufferService = new MockBufferService(80, 30);
|
||||||
bufferService.buffer.x = 1;
|
bufferService.buffer.x = 1;
|
||||||
@@ -117,37 +115,37 @@ describe('InputHandler', () => {
|
|||||||
const inputHandler = new InputHandler(term, bufferService, new MockCoreService());
|
const inputHandler = new InputHandler(term, bufferService, new MockCoreService());
|
||||||
|
|
||||||
// insert some data in first and second line
|
// insert some data in first and second line
|
||||||
inputHandler.parse(Array(term.cols - 9).join('a'));
|
inputHandler.parse(Array(bufferService.cols - 9).join('a'));
|
||||||
inputHandler.parse('1234567890');
|
inputHandler.parse('1234567890');
|
||||||
inputHandler.parse(Array(term.cols - 9).join('a'));
|
inputHandler.parse(Array(bufferService.cols - 9).join('a'));
|
||||||
inputHandler.parse('1234567890');
|
inputHandler.parse('1234567890');
|
||||||
const line1: IBufferLine = bufferService.buffer.lines.get(0);
|
const line1: IBufferLine = bufferService.buffer.lines.get(0);
|
||||||
expect(line1.translateToString(false)).equals(Array(term.cols - 9).join('a') + '1234567890');
|
expect(line1.translateToString(false)).equals(Array(bufferService.cols - 9).join('a') + '1234567890');
|
||||||
|
|
||||||
// insert one char from params = [0]
|
// insert one char from params = [0]
|
||||||
bufferService.buffer.y = 0;
|
bufferService.buffer.y = 0;
|
||||||
bufferService.buffer.x = 70;
|
bufferService.buffer.x = 70;
|
||||||
inputHandler.insertChars(Params.fromArray([0]));
|
inputHandler.insertChars(Params.fromArray([0]));
|
||||||
expect(line1.translateToString(false)).equals(Array(term.cols - 9).join('a') + ' 123456789');
|
expect(line1.translateToString(false)).equals(Array(bufferService.cols - 9).join('a') + ' 123456789');
|
||||||
|
|
||||||
// insert one char from params = [1]
|
// insert one char from params = [1]
|
||||||
bufferService.buffer.y = 0;
|
bufferService.buffer.y = 0;
|
||||||
bufferService.buffer.x = 70;
|
bufferService.buffer.x = 70;
|
||||||
inputHandler.insertChars(Params.fromArray([1]));
|
inputHandler.insertChars(Params.fromArray([1]));
|
||||||
expect(line1.translateToString(false)).equals(Array(term.cols - 9).join('a') + ' 12345678');
|
expect(line1.translateToString(false)).equals(Array(bufferService.cols - 9).join('a') + ' 12345678');
|
||||||
|
|
||||||
// insert two chars from params = [2]
|
// insert two chars from params = [2]
|
||||||
bufferService.buffer.y = 0;
|
bufferService.buffer.y = 0;
|
||||||
bufferService.buffer.x = 70;
|
bufferService.buffer.x = 70;
|
||||||
inputHandler.insertChars(Params.fromArray([2]));
|
inputHandler.insertChars(Params.fromArray([2]));
|
||||||
expect(line1.translateToString(false)).equals(Array(term.cols - 9).join('a') + ' 123456');
|
expect(line1.translateToString(false)).equals(Array(bufferService.cols - 9).join('a') + ' 123456');
|
||||||
|
|
||||||
// insert 10 chars from params = [10]
|
// insert 10 chars from params = [10]
|
||||||
bufferService.buffer.y = 0;
|
bufferService.buffer.y = 0;
|
||||||
bufferService.buffer.x = 70;
|
bufferService.buffer.x = 70;
|
||||||
inputHandler.insertChars(Params.fromArray([10]));
|
inputHandler.insertChars(Params.fromArray([10]));
|
||||||
expect(line1.translateToString(false)).equals(Array(term.cols - 9).join('a') + ' ');
|
expect(line1.translateToString(false)).equals(Array(bufferService.cols - 9).join('a') + ' ');
|
||||||
expect(line1.translateToString(true)).equals(Array(term.cols - 9).join('a'));
|
expect(line1.translateToString(true)).equals(Array(bufferService.cols - 9).join('a'));
|
||||||
});
|
});
|
||||||
it('deleteChars', function(): void {
|
it('deleteChars', function(): void {
|
||||||
const term = new Terminal();
|
const term = new Terminal();
|
||||||
@@ -155,40 +153,40 @@ describe('InputHandler', () => {
|
|||||||
const inputHandler = new InputHandler(term, bufferService, new MockCoreService());
|
const inputHandler = new InputHandler(term, bufferService, new MockCoreService());
|
||||||
|
|
||||||
// insert some data in first and second line
|
// insert some data in first and second line
|
||||||
inputHandler.parse(Array(term.cols - 9).join('a'));
|
inputHandler.parse(Array(bufferService.cols - 9).join('a'));
|
||||||
inputHandler.parse('1234567890');
|
inputHandler.parse('1234567890');
|
||||||
inputHandler.parse(Array(term.cols - 9).join('a'));
|
inputHandler.parse(Array(bufferService.cols - 9).join('a'));
|
||||||
inputHandler.parse('1234567890');
|
inputHandler.parse('1234567890');
|
||||||
const line1: IBufferLine = bufferService.buffer.lines.get(0);
|
const line1: IBufferLine = bufferService.buffer.lines.get(0);
|
||||||
expect(line1.translateToString(false)).equals(Array(term.cols - 9).join('a') + '1234567890');
|
expect(line1.translateToString(false)).equals(Array(bufferService.cols - 9).join('a') + '1234567890');
|
||||||
|
|
||||||
// delete one char from params = [0]
|
// delete one char from params = [0]
|
||||||
bufferService.buffer.y = 0;
|
bufferService.buffer.y = 0;
|
||||||
bufferService.buffer.x = 70;
|
bufferService.buffer.x = 70;
|
||||||
inputHandler.deleteChars(Params.fromArray([0]));
|
inputHandler.deleteChars(Params.fromArray([0]));
|
||||||
expect(line1.translateToString(false)).equals(Array(term.cols - 9).join('a') + '234567890 ');
|
expect(line1.translateToString(false)).equals(Array(bufferService.cols - 9).join('a') + '234567890 ');
|
||||||
expect(line1.translateToString(true)).equals(Array(term.cols - 9).join('a') + '234567890');
|
expect(line1.translateToString(true)).equals(Array(bufferService.cols - 9).join('a') + '234567890');
|
||||||
|
|
||||||
// insert one char from params = [1]
|
// insert one char from params = [1]
|
||||||
bufferService.buffer.y = 0;
|
bufferService.buffer.y = 0;
|
||||||
bufferService.buffer.x = 70;
|
bufferService.buffer.x = 70;
|
||||||
inputHandler.deleteChars(Params.fromArray([1]));
|
inputHandler.deleteChars(Params.fromArray([1]));
|
||||||
expect(line1.translateToString(false)).equals(Array(term.cols - 9).join('a') + '34567890 ');
|
expect(line1.translateToString(false)).equals(Array(bufferService.cols - 9).join('a') + '34567890 ');
|
||||||
expect(line1.translateToString(true)).equals(Array(term.cols - 9).join('a') + '34567890');
|
expect(line1.translateToString(true)).equals(Array(bufferService.cols - 9).join('a') + '34567890');
|
||||||
|
|
||||||
// insert two chars from params = [2]
|
// insert two chars from params = [2]
|
||||||
bufferService.buffer.y = 0;
|
bufferService.buffer.y = 0;
|
||||||
bufferService.buffer.x = 70;
|
bufferService.buffer.x = 70;
|
||||||
inputHandler.deleteChars(Params.fromArray([2]));
|
inputHandler.deleteChars(Params.fromArray([2]));
|
||||||
expect(line1.translateToString(false)).equals(Array(term.cols - 9).join('a') + '567890 ');
|
expect(line1.translateToString(false)).equals(Array(bufferService.cols - 9).join('a') + '567890 ');
|
||||||
expect(line1.translateToString(true)).equals(Array(term.cols - 9).join('a') + '567890');
|
expect(line1.translateToString(true)).equals(Array(bufferService.cols - 9).join('a') + '567890');
|
||||||
|
|
||||||
// insert 10 chars from params = [10]
|
// insert 10 chars from params = [10]
|
||||||
bufferService.buffer.y = 0;
|
bufferService.buffer.y = 0;
|
||||||
bufferService.buffer.x = 70;
|
bufferService.buffer.x = 70;
|
||||||
inputHandler.deleteChars(Params.fromArray([10]));
|
inputHandler.deleteChars(Params.fromArray([10]));
|
||||||
expect(line1.translateToString(false)).equals(Array(term.cols - 9).join('a') + ' ');
|
expect(line1.translateToString(false)).equals(Array(bufferService.cols - 9).join('a') + ' ');
|
||||||
expect(line1.translateToString(true)).equals(Array(term.cols - 9).join('a'));
|
expect(line1.translateToString(true)).equals(Array(bufferService.cols - 9).join('a'));
|
||||||
});
|
});
|
||||||
it('eraseInLine', function(): void {
|
it('eraseInLine', function(): void {
|
||||||
const term = new Terminal();
|
const term = new Terminal();
|
||||||
@@ -196,9 +194,9 @@ describe('InputHandler', () => {
|
|||||||
const inputHandler = new InputHandler(term, bufferService, new MockCoreService());
|
const inputHandler = new InputHandler(term, bufferService, new MockCoreService());
|
||||||
|
|
||||||
// fill 6 lines to test 3 different states
|
// fill 6 lines to test 3 different states
|
||||||
inputHandler.parse(Array(term.cols + 1).join('a'));
|
inputHandler.parse(Array(bufferService.cols + 1).join('a'));
|
||||||
inputHandler.parse(Array(term.cols + 1).join('a'));
|
inputHandler.parse(Array(bufferService.cols + 1).join('a'));
|
||||||
inputHandler.parse(Array(term.cols + 1).join('a'));
|
inputHandler.parse(Array(bufferService.cols + 1).join('a'));
|
||||||
|
|
||||||
// params[0] - right erase
|
// params[0] - right erase
|
||||||
bufferService.buffer.y = 0;
|
bufferService.buffer.y = 0;
|
||||||
@@ -216,7 +214,7 @@ describe('InputHandler', () => {
|
|||||||
bufferService.buffer.y = 2;
|
bufferService.buffer.y = 2;
|
||||||
bufferService.buffer.x = 70;
|
bufferService.buffer.x = 70;
|
||||||
inputHandler.eraseInLine(Params.fromArray([2]));
|
inputHandler.eraseInLine(Params.fromArray([2]));
|
||||||
expect(bufferService.buffer.lines.get(2).translateToString(false)).equals(Array(term.cols + 1).join(' '));
|
expect(bufferService.buffer.lines.get(2).translateToString(false)).equals(Array(bufferService.cols + 1).join(' '));
|
||||||
|
|
||||||
});
|
});
|
||||||
it('eraseInDisplay', function(): void {
|
it('eraseInDisplay', function(): void {
|
||||||
@@ -225,7 +223,7 @@ describe('InputHandler', () => {
|
|||||||
const inputHandler = new InputHandler(term, bufferService, new MockCoreService());
|
const inputHandler = new InputHandler(term, bufferService, new MockCoreService());
|
||||||
|
|
||||||
// fill display with a's
|
// fill display with a's
|
||||||
for (let i = 0; i < term.rows; ++i) inputHandler.parse(Array(bufferService.cols + 1).join('a'));
|
for (let i = 0; i < bufferService.rows; ++i) inputHandler.parse(Array(bufferService.cols + 1).join('a'));
|
||||||
|
|
||||||
// params [0] - right and below erase
|
// params [0] - right and below erase
|
||||||
bufferService.buffer.y = 5;
|
bufferService.buffer.y = 5;
|
||||||
|
|||||||
+29
-29
@@ -368,7 +368,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
const buffer = this._bufferService.buffer;
|
const buffer = this._bufferService.buffer;
|
||||||
const charset = this._terminal.charset;
|
const charset = this._terminal.charset;
|
||||||
const screenReaderMode = this._terminal.options.screenReaderMode;
|
const screenReaderMode = this._terminal.options.screenReaderMode;
|
||||||
const cols = this._terminal.cols;
|
const cols = this._bufferService.cols;
|
||||||
const wraparoundMode = this._terminal.wraparoundMode;
|
const wraparoundMode = this._terminal.wraparoundMode;
|
||||||
const insertMode = this._terminal.insertMode;
|
const insertMode = this._terminal.insertMode;
|
||||||
const curAttr = this._terminal.curAttrData;
|
const curAttr = this._terminal.curAttrData;
|
||||||
@@ -525,7 +525,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
this._terminal.scroll();
|
this._terminal.scroll();
|
||||||
}
|
}
|
||||||
// If the end of the line is hit, prevent this action from wrapping around to the next line.
|
// If the end of the line is hit, prevent this action from wrapping around to the next line.
|
||||||
if (buffer.x >= this._terminal.cols) {
|
if (buffer.x >= this._bufferService.cols) {
|
||||||
buffer.x--;
|
buffer.x--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -556,7 +556,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
* Horizontal Tab (HT) (Ctrl-I).
|
* Horizontal Tab (HT) (Ctrl-I).
|
||||||
*/
|
*/
|
||||||
public tab(): void {
|
public tab(): void {
|
||||||
if (this._bufferService.buffer.x >= this._terminal.cols) {
|
if (this._bufferService.buffer.x >= this._bufferService.cols) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const originalX = this._bufferService.buffer.x;
|
const originalX = this._bufferService.buffer.x;
|
||||||
@@ -588,10 +588,10 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
* Restrict cursor to viewport size / scroll margin (origin mode).
|
* Restrict cursor to viewport size / scroll margin (origin mode).
|
||||||
*/
|
*/
|
||||||
private _restrictCursor(): void {
|
private _restrictCursor(): void {
|
||||||
this._bufferService.buffer.x = Math.min(this._terminal.cols - 1, Math.max(0, this._bufferService.buffer.x));
|
this._bufferService.buffer.x = Math.min(this._bufferService.cols - 1, Math.max(0, this._bufferService.buffer.x));
|
||||||
this._bufferService.buffer.y = this._terminal.originMode
|
this._bufferService.buffer.y = this._terminal.originMode
|
||||||
? Math.min(this._bufferService.buffer.scrollBottom, Math.max(this._bufferService.buffer.scrollTop, this._bufferService.buffer.y))
|
? Math.min(this._bufferService.buffer.scrollBottom, Math.max(this._bufferService.buffer.scrollTop, this._bufferService.buffer.y))
|
||||||
: Math.min(this._terminal.rows - 1, Math.max(0, this._bufferService.buffer.y));
|
: Math.min(this._bufferService.rows - 1, Math.max(0, this._bufferService.buffer.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -757,7 +757,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
* Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).
|
* Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).
|
||||||
*/
|
*/
|
||||||
public cursorForwardTab(params: IParams): void {
|
public cursorForwardTab(params: IParams): void {
|
||||||
if (this._bufferService.buffer.x >= this._terminal.cols) {
|
if (this._bufferService.buffer.x >= this._bufferService.cols) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let param = params.params[0] || 1;
|
let param = params.params[0] || 1;
|
||||||
@@ -770,7 +770,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
* CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).
|
* CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).
|
||||||
*/
|
*/
|
||||||
public cursorBackwardTab(params: IParams): void {
|
public cursorBackwardTab(params: IParams): void {
|
||||||
if (this._bufferService.buffer.x >= this._terminal.cols) {
|
if (this._bufferService.buffer.x >= this._bufferService.cols) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let param = params.params[0] || 1;
|
let param = params.params[0] || 1;
|
||||||
@@ -833,8 +833,8 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
case 0:
|
case 0:
|
||||||
j = this._bufferService.buffer.y;
|
j = this._bufferService.buffer.y;
|
||||||
this._terminal.updateRange(j);
|
this._terminal.updateRange(j);
|
||||||
this._eraseInBufferLine(j++, this._bufferService.buffer.x, this._terminal.cols, this._bufferService.buffer.x === 0);
|
this._eraseInBufferLine(j++, this._bufferService.buffer.x, this._bufferService.cols, this._bufferService.buffer.x === 0);
|
||||||
for (; j < this._terminal.rows; j++) {
|
for (; j < this._bufferService.rows; j++) {
|
||||||
this._resetBufferLine(j);
|
this._resetBufferLine(j);
|
||||||
}
|
}
|
||||||
this._terminal.updateRange(j);
|
this._terminal.updateRange(j);
|
||||||
@@ -844,7 +844,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
this._terminal.updateRange(j);
|
this._terminal.updateRange(j);
|
||||||
// Deleted front part of line and everything before. This line will no longer be wrapped.
|
// Deleted front part of line and everything before. This line will no longer be wrapped.
|
||||||
this._eraseInBufferLine(j, 0, this._bufferService.buffer.x + 1, true);
|
this._eraseInBufferLine(j, 0, this._bufferService.buffer.x + 1, true);
|
||||||
if (this._bufferService.buffer.x + 1 >= this._terminal.cols) {
|
if (this._bufferService.buffer.x + 1 >= this._bufferService.cols) {
|
||||||
// Deleted entire previous line. This next line can no longer be wrapped.
|
// Deleted entire previous line. This next line can no longer be wrapped.
|
||||||
this._bufferService.buffer.lines.get(j + 1).isWrapped = false;
|
this._bufferService.buffer.lines.get(j + 1).isWrapped = false;
|
||||||
}
|
}
|
||||||
@@ -854,7 +854,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
this._terminal.updateRange(0);
|
this._terminal.updateRange(0);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
j = this._terminal.rows;
|
j = this._bufferService.rows;
|
||||||
this._terminal.updateRange(j - 1);
|
this._terminal.updateRange(j - 1);
|
||||||
while (j--) {
|
while (j--) {
|
||||||
this._resetBufferLine(j);
|
this._resetBufferLine(j);
|
||||||
@@ -863,7 +863,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// Clear scrollback (everything not in viewport)
|
// Clear scrollback (everything not in viewport)
|
||||||
const scrollBackSize = this._bufferService.buffer.lines.length - this._terminal.rows;
|
const scrollBackSize = this._bufferService.buffer.lines.length - this._bufferService.rows;
|
||||||
if (scrollBackSize > 0) {
|
if (scrollBackSize > 0) {
|
||||||
this._bufferService.buffer.lines.trimStart(scrollBackSize);
|
this._bufferService.buffer.lines.trimStart(scrollBackSize);
|
||||||
this._bufferService.buffer.ybase = Math.max(this._bufferService.buffer.ybase - scrollBackSize, 0);
|
this._bufferService.buffer.ybase = Math.max(this._bufferService.buffer.ybase - scrollBackSize, 0);
|
||||||
@@ -890,13 +890,13 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
this._restrictCursor();
|
this._restrictCursor();
|
||||||
switch (params.params[0]) {
|
switch (params.params[0]) {
|
||||||
case 0:
|
case 0:
|
||||||
this._eraseInBufferLine(this._bufferService.buffer.y, this._bufferService.buffer.x, this._terminal.cols);
|
this._eraseInBufferLine(this._bufferService.buffer.y, this._bufferService.buffer.x, this._bufferService.cols);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this._eraseInBufferLine(this._bufferService.buffer.y, 0, this._bufferService.buffer.x + 1);
|
this._eraseInBufferLine(this._bufferService.buffer.y, 0, this._bufferService.buffer.x + 1);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this._eraseInBufferLine(this._bufferService.buffer.y, 0, this._terminal.cols);
|
this._eraseInBufferLine(this._bufferService.buffer.y, 0, this._bufferService.cols);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this._terminal.updateRange(this._bufferService.buffer.y);
|
this._terminal.updateRange(this._bufferService.buffer.y);
|
||||||
@@ -919,8 +919,8 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
|
|
||||||
const row: number = buffer.y + buffer.ybase;
|
const row: number = buffer.y + buffer.ybase;
|
||||||
|
|
||||||
const scrollBottomRowsOffset = this._terminal.rows - 1 - buffer.scrollBottom;
|
const scrollBottomRowsOffset = this._bufferService.rows - 1 - buffer.scrollBottom;
|
||||||
const scrollBottomAbsolute = this._terminal.rows - 1 + buffer.ybase - scrollBottomRowsOffset + 1;
|
const scrollBottomAbsolute = this._bufferService.rows - 1 + buffer.ybase - scrollBottomRowsOffset + 1;
|
||||||
while (param--) {
|
while (param--) {
|
||||||
// test: echo -e '\e[44m\e[1L\e[0m'
|
// test: echo -e '\e[44m\e[1L\e[0m'
|
||||||
// blankLine(true) - xterm/linux behavior
|
// blankLine(true) - xterm/linux behavior
|
||||||
@@ -952,8 +952,8 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
const row: number = buffer.y + buffer.ybase;
|
const row: number = buffer.y + buffer.ybase;
|
||||||
|
|
||||||
let j: number;
|
let j: number;
|
||||||
j = this._terminal.rows - 1 - buffer.scrollBottom;
|
j = this._bufferService.rows - 1 - buffer.scrollBottom;
|
||||||
j = this._terminal.rows - 1 + buffer.ybase - j;
|
j = this._bufferService.rows - 1 + buffer.ybase - j;
|
||||||
while (param--) {
|
while (param--) {
|
||||||
// test: echo -e '\e[44m\e[1M\e[0m'
|
// test: echo -e '\e[44m\e[1M\e[0m'
|
||||||
// blankLine(true) - xterm/linux behavior
|
// blankLine(true) - xterm/linux behavior
|
||||||
@@ -1273,8 +1273,8 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
break;
|
break;
|
||||||
case 3: // 132 col mode
|
case 3: // 132 col mode
|
||||||
// TODO: move DECCOLM into compat addon
|
// TODO: move DECCOLM into compat addon
|
||||||
this._terminal.savedCols = this._terminal.cols;
|
this._terminal.savedCols = this._bufferService.cols;
|
||||||
this._terminal.resize(132, this._terminal.rows);
|
this._terminal.resize(132, this._bufferService.rows);
|
||||||
this._terminal.reset();
|
this._terminal.reset();
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
@@ -1354,7 +1354,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
case 47: // alt screen buffer
|
case 47: // alt screen buffer
|
||||||
case 1047: // alt screen buffer
|
case 1047: // alt screen buffer
|
||||||
this._bufferService.buffers.activateAltBuffer(this._terminal.eraseAttrData());
|
this._bufferService.buffers.activateAltBuffer(this._terminal.eraseAttrData());
|
||||||
this._terminal.refresh(0, this._terminal.rows - 1);
|
this._terminal.refresh(0, this._bufferService.rows - 1);
|
||||||
if (this._terminal.viewport) {
|
if (this._terminal.viewport) {
|
||||||
this._terminal.viewport.syncScrollArea();
|
this._terminal.viewport.syncScrollArea();
|
||||||
}
|
}
|
||||||
@@ -1474,8 +1474,8 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
// TODO: move DECCOLM into compat addon
|
// TODO: move DECCOLM into compat addon
|
||||||
// Note: This impl currently does not enforce col 80, instead reverts
|
// Note: This impl currently does not enforce col 80, instead reverts
|
||||||
// to previous terminal width before entering DECCOLM 132
|
// to previous terminal width before entering DECCOLM 132
|
||||||
if (this._terminal.cols === 132 && this._terminal.savedCols) {
|
if (this._bufferService.cols === 132 && this._terminal.savedCols) {
|
||||||
this._terminal.resize(this._terminal.savedCols, this._terminal.rows);
|
this._terminal.resize(this._terminal.savedCols, this._bufferService.rows);
|
||||||
}
|
}
|
||||||
delete this._terminal.savedCols;
|
delete this._terminal.savedCols;
|
||||||
this._terminal.reset();
|
this._terminal.reset();
|
||||||
@@ -1539,7 +1539,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
if (param === 1049) {
|
if (param === 1049) {
|
||||||
this.restoreCursor();
|
this.restoreCursor();
|
||||||
}
|
}
|
||||||
this._terminal.refresh(0, this._terminal.rows - 1);
|
this._terminal.refresh(0, this._bufferService.rows - 1);
|
||||||
if (this._terminal.viewport) {
|
if (this._terminal.viewport) {
|
||||||
this._terminal.viewport.syncScrollArea();
|
this._terminal.viewport.syncScrollArea();
|
||||||
}
|
}
|
||||||
@@ -1870,7 +1870,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
}
|
}
|
||||||
this._coreService.decPrivateModes.applicationCursorKeys = false;
|
this._coreService.decPrivateModes.applicationCursorKeys = false;
|
||||||
this._bufferService.buffer.scrollTop = 0;
|
this._bufferService.buffer.scrollTop = 0;
|
||||||
this._bufferService.buffer.scrollBottom = this._terminal.rows - 1;
|
this._bufferService.buffer.scrollBottom = this._bufferService.rows - 1;
|
||||||
this._terminal.curAttrData = DEFAULT_ATTR_DATA.clone();
|
this._terminal.curAttrData = DEFAULT_ATTR_DATA.clone();
|
||||||
this._bufferService.buffer.x = this._bufferService.buffer.y = 0; // ?
|
this._bufferService.buffer.x = this._bufferService.buffer.y = 0; // ?
|
||||||
this._terminal.charset = null;
|
this._terminal.charset = null;
|
||||||
@@ -1926,8 +1926,8 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
const top = params.params[0] || 1;
|
const top = params.params[0] || 1;
|
||||||
let bottom: number;
|
let bottom: number;
|
||||||
|
|
||||||
if (params.length < 2 || (bottom = params.params[1]) > this._terminal.rows || bottom === 0) {
|
if (params.length < 2 || (bottom = params.params[1]) > this._bufferService.rows || bottom === 0) {
|
||||||
bottom = this._terminal.rows;
|
bottom = this._bufferService.rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bottom > top) {
|
if (bottom > top) {
|
||||||
@@ -2149,13 +2149,13 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|||||||
const buffer = this._bufferService.buffer;
|
const buffer = this._bufferService.buffer;
|
||||||
|
|
||||||
this._setCursor(0, 0);
|
this._setCursor(0, 0);
|
||||||
for (let yOffset = 0; yOffset < this._terminal.rows; ++yOffset) {
|
for (let yOffset = 0; yOffset < this._bufferService.rows; ++yOffset) {
|
||||||
const row = buffer.y + buffer.ybase + yOffset;
|
const row = buffer.y + buffer.ybase + yOffset;
|
||||||
buffer.lines.get(row).fill(cell);
|
buffer.lines.get(row).fill(cell);
|
||||||
buffer.lines.get(row).isWrapped = false;
|
buffer.lines.get(row).isWrapped = false;
|
||||||
}
|
}
|
||||||
this._terminal.updateRange(0);
|
this._terminal.updateRange(0);
|
||||||
this._terminal.updateRange(this._terminal.rows);
|
this._terminal.updateRange(this._bufferService.rows);
|
||||||
this._setCursor(0, 0);
|
this._setCursor(0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user