Merge branch 'master' into strikethrough
This commit is contained in:
@@ -77,7 +77,7 @@ describe('InputHandler', () => {
|
||||
optionsService.options.scrollback = 1;
|
||||
bufferService.reset();
|
||||
});
|
||||
it('SL (scrollLeft)', async () => {
|
||||
it('SL (scrollLeft)', () => {
|
||||
inputHandler.parseP('12345'.repeat(6));
|
||||
inputHandler.parseP('\x1b[ @');
|
||||
assert.deepEqual(getLines(bufferService, 6), ['12345', '2345', '2345', '2345', '2345', '2345']);
|
||||
@@ -86,7 +86,7 @@ describe('InputHandler', () => {
|
||||
inputHandler.parseP('\x1b[2 @');
|
||||
assert.deepEqual(getLines(bufferService, 6), ['12345', '5', '5', '5', '5', '5']);
|
||||
});
|
||||
it('SR (scrollRight)', async () => {
|
||||
it('SR (scrollRight)', () => {
|
||||
inputHandler.parseP('12345'.repeat(6));
|
||||
inputHandler.parseP('\x1b[ A');
|
||||
assert.deepEqual(getLines(bufferService, 6), ['12345', ' 1234', ' 1234', ' 1234', ' 1234', ' 1234']);
|
||||
@@ -95,7 +95,7 @@ describe('InputHandler', () => {
|
||||
inputHandler.parseP('\x1b[2 A');
|
||||
assert.deepEqual(getLines(bufferService, 6), ['12345', ' 1', ' 1', ' 1', ' 1', ' 1']);
|
||||
});
|
||||
it('insertColumns (DECIC)', async () => {
|
||||
it('insertColumns (DECIC)', () => {
|
||||
inputHandler.parseP('12345'.repeat(6));
|
||||
inputHandler.parseP('\x1b[3;3H');
|
||||
inputHandler.parseP('\x1b[\'}');
|
||||
@@ -111,7 +111,7 @@ describe('InputHandler', () => {
|
||||
inputHandler.parseP('\x1b[2\'}');
|
||||
assert.deepEqual(getLines(bufferService, 6), ['12345', '12 3', '12 3', '12 3', '12 3', '12 3']);
|
||||
});
|
||||
it('deleteColumns (DECDC)', async () => {
|
||||
it('deleteColumns (DECDC)', () => {
|
||||
inputHandler.parseP('12345'.repeat(6));
|
||||
inputHandler.parseP('\x1b[3;3H');
|
||||
inputHandler.parseP('\x1b[\'~');
|
||||
@@ -137,7 +137,7 @@ describe('InputHandler', () => {
|
||||
bufferService.reset();
|
||||
});
|
||||
describe('reverseWraparound set', () => {
|
||||
it('should not reverse outside of scroll margins', async () => {
|
||||
it('should not reverse outside of scroll margins', () => {
|
||||
// prepare buffer content
|
||||
inputHandler.parseP('#####abcdefghijklmnopqrstuvwxy');
|
||||
assert.deepEqual(getLines(bufferService, 6), ['#####', 'abcde', 'fghij', 'klmno', 'pqrst', 'uvwxy']);
|
||||
@@ -1919,6 +1919,92 @@ describe('InputHandler', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// issue #3362 and #2979
|
||||
describe('EL/ED cursor at buffer.cols', () => {
|
||||
beforeEach(() => {
|
||||
bufferService.resize(10, 5);
|
||||
});
|
||||
describe('cursor should stay at cols / does not overflow', () => {
|
||||
it('EL0', async () => {
|
||||
await inputHandler.parseP('##########\x1b[0K');
|
||||
assert.equal(bufferService.buffer.x, 10);
|
||||
assert.deepEqual(getLines(bufferService), ['#'.repeat(10), '', '', '', '']);
|
||||
});
|
||||
it('EL1', async () => {
|
||||
await inputHandler.parseP('##########\x1b[1K');
|
||||
assert.equal(bufferService.buffer.x, 10);
|
||||
assert.deepEqual(getLines(bufferService), ['', '', '', '', '']);
|
||||
});
|
||||
it('EL2', async () => {
|
||||
await inputHandler.parseP('##########\x1b[2K');
|
||||
assert.equal(bufferService.buffer.x, 10);
|
||||
assert.deepEqual(getLines(bufferService), ['', '', '', '', '']);
|
||||
});
|
||||
it('ED0', async () => {
|
||||
await inputHandler.parseP('##########\x1b[0J');
|
||||
assert.equal(bufferService.buffer.x, 10);
|
||||
assert.deepEqual(getLines(bufferService), ['#'.repeat(10), '', '', '', '']);
|
||||
});
|
||||
it('ED1', async () => {
|
||||
await inputHandler.parseP('##########\x1b[1J');
|
||||
assert.equal(bufferService.buffer.x, 10);
|
||||
assert.deepEqual(getLines(bufferService), ['', '', '', '', '']);
|
||||
});
|
||||
it('ED2', async () => {
|
||||
await inputHandler.parseP('##########\x1b[2J');
|
||||
assert.equal(bufferService.buffer.x, 10);
|
||||
assert.deepEqual(getLines(bufferService), ['', '', '', '', '']);
|
||||
});
|
||||
it('ED3', async () => {
|
||||
await inputHandler.parseP('##########\x1b[3J');
|
||||
assert.equal(bufferService.buffer.x, 10);
|
||||
assert.deepEqual(getLines(bufferService), ['#'.repeat(10), '', '', '', '']);
|
||||
});
|
||||
});
|
||||
describe('following sequence keeps working', () => {
|
||||
// sequences to test (cursor related ones)
|
||||
const SEQ = [
|
||||
/* ICH */ '\x1b[10@',
|
||||
/* SL */ '\x1b[10 @',
|
||||
/* CUU */ '\x1b[10A',
|
||||
/* SR */ '\x1b[10 A',
|
||||
/* CUD */ '\x1b[10B',
|
||||
/* CUF */ '\x1b[10C',
|
||||
/* CUB */ '\x1b[10D',
|
||||
/* CNL */ '\x1b[10E',
|
||||
/* CPL */ '\x1b[10F',
|
||||
/* CHA */ '\x1b[10G',
|
||||
/* CUP */ '\x1b[10;10H',
|
||||
/* CHT */ '\x1b[10I',
|
||||
/* IL */ '\x1b[10L',
|
||||
/* DL */ '\x1b[10M',
|
||||
/* DCH */ '\x1b[10P',
|
||||
/* SU */ '\x1b[10S',
|
||||
/* SD */ '\x1b[10T',
|
||||
/* ECH */ '\x1b[10X',
|
||||
/* CBT */ '\x1b[10Z',
|
||||
/* HPA */ '\x1b[10`',
|
||||
/* HPR */ '\x1b[10a',
|
||||
/* REP */ '\x1b[10b',
|
||||
/* VPA */ '\x1b[10d',
|
||||
/* VPR */ '\x1b[10e',
|
||||
/* HVP */ '\x1b[10;10f',
|
||||
/* TBC */ '\x1b[0g',
|
||||
/* SCOSC */ '\x1b[s',
|
||||
/* DECIC */ '\x1b[10\'}',
|
||||
/* DECDC */ '\x1b[10\'~'
|
||||
];
|
||||
it('cursor never advances beyond cols', async () => {
|
||||
for (const seq of SEQ) {
|
||||
await inputHandler.parseP('##########\x1b[2J' + seq);
|
||||
assert.equal(bufferService.buffer.x <= bufferService.cols, true);
|
||||
inputHandler.reset();
|
||||
bufferService.reset();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user