From f8fa962ec7d376a9799d60bc76db6ab2537aea83 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Thu, 24 Oct 2019 09:35:12 -0700 Subject: [PATCH 01/25] Fix lgtm suppression comment line --- demo/server.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/demo/server.js b/demo/server.js index f04705aa..85e1aca7 100644 --- a/demo/server.js +++ b/demo/server.js @@ -14,20 +14,20 @@ function startServer() { logs = {}; app.use('/xterm.css', express.static(__dirname + '/../css/xterm.css')); - app.get('/logo.png', (req, res) => { - res.sendFile(__dirname + '/logo.png'); // lgtm [js/missing-rate-limiting] + app.get('/logo.png', (req, res) => { // lgtm [js/missing-rate-limiting] + res.sendFile(__dirname + '/logo.png'); }); - app.get('/', (req, res) => { - res.sendFile(__dirname + '/index.html'); // lgtm [js/missing-rate-limiting] + app.get('/', (req, res) => { // lgtm [js/missing-rate-limiting] + res.sendFile(__dirname + '/index.html'); }); - app.get('/test', (req, res) => { - res.sendFile(__dirname + '/test.html'); // lgtm [js/missing-rate-limiting] + app.get('/test', (req, res) => { // lgtm [js/missing-rate-limiting] + res.sendFile(__dirname + '/test.html'); }); - app.get('/style.css', (req, res) => { - res.sendFile(__dirname + '/style.css'); // lgtm [js/missing-rate-limiting] + app.get('/style.css', (req, res) => { // lgtm [js/missing-rate-limiting] + res.sendFile(__dirname + '/style.css'); }); app.use('/dist', express.static(__dirname + '/dist')); From 5ea016d537130bcadfdf39c1a39a4dd6f8a9bcbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Thu, 24 Oct 2019 21:57:22 +0200 Subject: [PATCH 02/25] remove URXVT and UTF8 encoding from codebase --- src/common/services/CoreMouseService.test.ts | 18 +- src/common/services/CoreMouseService.ts | 19 - test/api/MouseTracking.api.ts | 1184 ------------------ 3 files changed, 1 insertion(+), 1220 deletions(-) diff --git a/src/common/services/CoreMouseService.test.ts b/src/common/services/CoreMouseService.test.ts index 2063a496..71d06da5 100644 --- a/src/common/services/CoreMouseService.test.ts +++ b/src/common/services/CoreMouseService.test.ts @@ -34,7 +34,7 @@ describe('CoreMouseService', () => { }); it('default encodings - DEFAULT, UTF8, SGR, URXVT', () => { const cms = new CoreMouseService(bufferService, coreService); - assert.deepEqual(Object.keys((cms as any)._encodings), ['DEFAULT', 'UTF8', 'SGR', 'URXVT']); + assert.deepEqual(Object.keys((cms as any)._encodings), ['DEFAULT', 'SGR']); }); it('protocol/encoding setter, reset', () => { const cms = new CoreMouseService(bufferService, coreService); @@ -151,14 +151,6 @@ describe('CoreMouseService', () => { } } }); - it('UTF8 encoding', () => { - cms.activeProtocol = 'ANY'; - cms.activeEncoding = 'UTF8'; - for (let i = 0; i < bufferService.cols; ++i) { - assert.equal(cms.triggerMouseEvent({ col: i, row: 0, button: CoreMouseButton.LEFT, action: CoreMouseAction.DOWN }), true); - assert.deepEqual(toBytes(reports.pop()), [0x1b, 0x5b, 0x4d, 0x20, i + 33, 0x21]); - } - }); it('SGR encoding', () => { cms.activeProtocol = 'ANY'; cms.activeEncoding = 'SGR'; @@ -167,14 +159,6 @@ describe('CoreMouseService', () => { assert.deepEqual(reports.pop(), `\x1b[<0;${i + 1};1M`); } }); - it('URXVT', () => { - cms.activeProtocol = 'ANY'; - cms.activeEncoding = 'URXVT'; - for (let i = 0; i < bufferService.cols; ++i) { - assert.equal(cms.triggerMouseEvent({ col: i, row: 0, button: CoreMouseButton.LEFT, action: CoreMouseAction.DOWN }), true); - assert.deepEqual(reports.pop(), `\x1b[32;${i + 1};1M`); - } - }); }); it('eventCodes with modifiers (DEFAULT encoding)', () => { // TODO: implement AUX button tests diff --git a/src/common/services/CoreMouseService.ts b/src/common/services/CoreMouseService.ts index 0c846519..19852d16 100644 --- a/src/common/services/CoreMouseService.ts +++ b/src/common/services/CoreMouseService.ts @@ -132,17 +132,6 @@ const DEFAULT_ENCODINGS: {[key: string]: CoreMouseEncoding} = { // FIXED: params = params.map(v => (v > 255) ? 0 : value); return `\x1b[M${S(params[0])}${S(params[1])}${S(params[2])}`; }, - /** - * UTF8 - CSI M Pb Px Py - * Same as DEFAULT, but with optional 2-byte UTF8 - * encoding for values > 223 (can encode up to 2015). - */ - UTF8: (e: ICoreMouseEvent) => { - let params = [eventCode(e, false) + 32, e.col + 32, e.row + 32]; - // limit to 2-byte UTF8 - params = params.map(v => (v > 2047) ? 0 : v); - return `\x1b[M${S(params[0])}${S(params[1])}${S(params[2])}`; - }, /** * SGR - CSI < Pb ; Px ; Py M|m * No encoding limitation. @@ -151,14 +140,6 @@ const DEFAULT_ENCODINGS: {[key: string]: CoreMouseEncoding} = { SGR: (e: ICoreMouseEvent) => { const final = (e.action === CoreMouseAction.UP && e.button !== CoreMouseButton.WHEEL) ? 'm' : 'M'; return `\x1b[<${eventCode(e, true)};${e.col};${e.row}${final}`; - }, - /** - * URXVT - CSI Pb ; Px ; Py M - * Same button encoding as default, decimal encoding for coords. - * Ambiguity with other sequences, should not be used. - */ - URXVT: (e: ICoreMouseEvent) => { - return `\x1b[${eventCode(e, false) + 32};${e.col};${e.row}M`; } }; diff --git a/test/api/MouseTracking.api.ts b/test/api/MouseTracking.api.ts index 1372b567..37d46f74 100644 --- a/test/api/MouseTracking.api.ts +++ b/test/api/MouseTracking.api.ts @@ -167,7 +167,6 @@ function parseReport(encoding: string, msg: number[]): {state: any; row: number; let col: number; // unpack msg const report = String.fromCharCode.apply(null, msg); - // console.log([report]); // skip non mouse reports if (!report || report[0] !== '\x1b') { return report; @@ -179,14 +178,6 @@ function parseReport(encoding: string, msg: number[]): {state: any; row: number; col: report.charCodeAt(4) - 32, row: report.charCodeAt(5) - 32 }; - case 'UTF8': - // TODO: once the binary patch is in place, - // use UTF8 byte check here - return { - state: evalButtonCode(report.charCodeAt(3) - 32), - col: report.charCodeAt(4) - 32, - row: report.charCodeAt(5) - 32 - }; case 'SGR': sReport = report.slice(3, -1); [buttonCode, col, row] = sReport.split(';').map(el => parseInt(el)); @@ -195,10 +186,6 @@ function parseReport(encoding: string, msg: number[]): {state: any; row: number; state.action = 'release'; } return {state, row, col}; - case 'URXVT': - sReport = report.slice(2, -1); - [buttonCode, col, row] = sReport.split(';').map(el => parseInt(el)); - return {state: evalButtonCode(buttonCode - 32), row, col}; default: return { state: evalButtonCode(report.charCodeAt(3) - 32), @@ -373,124 +360,6 @@ describe('Mouse Tracking Tests', function(): void { // await page.keyboard.up('Shift'); assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); }); - it.skip('UTF8 encoding', async () => { - const encoding = 'UTF8'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?9h\x1b[?1005h');`); - - // test at 0,0 - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [{col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - // mouseup should not report - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), []); - - // mousemove should not report - await mouseMove(50, 10); - assert.deepEqual(await getReports(encoding), []); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [{col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - // test at max rows/cols - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [{col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - // middle button - // bug: default action not cancelled (adds data to getReports from clipboard under X11) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]); - // right button - // bug: default action not cancelled (popup shown) - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('right'); - await mouseMove(44, 24); - await mouseUp('right'); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), []); - await wheelDown(); - assert.deepEqual(await getReports(encoding), []); - - // modifiers - // CTRL - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - - // ALT - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Alt'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Alt'); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - // SHIFT - // note: caught by selection manager - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Shift'); // defaults to ShiftLeft - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Shift'); - if (noShift) { - assert.deepEqual(await getReports(encoding), []); - } else { - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} - ]); - } - - // all modifiers - // bug: Shift not working - reporting totally wrong coords and modifiers - selection manager again? - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await page.keyboard.down('Alt'); - // await page.keyboard.down('Shift'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - await page.keyboard.up('Alt'); - // await page.keyboard.up('Shift'); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - }); it('SGR encoding', async () => { const encoding = 'SGR'; await resetMouseModes(); @@ -564,125 +433,6 @@ describe('Mouse Tracking Tests', function(): void { assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - // ALT - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Alt'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Alt'); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - // SHIFT - // note: caught by selection manager - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Shift'); // defaults to ShiftLeft - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Shift'); - if (noShift) { - assert.deepEqual(await getReports(encoding), []); - } else { - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} - ]); - } - - // all modifiers - // bug: Shift not working - reporting totally wrong coords and modifiers - selection manager again? - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await page.keyboard.down('Alt'); - // await page.keyboard.down('Shift'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - await page.keyboard.up('Alt'); - // await page.keyboard.up('Shift'); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - }); - it.skip('URXVT encoding', async () => { - // bug: always reports +1 for row/col (temp. fixed in parseReport to pass tests) - const encoding = 'URXVT'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?9h\x1b[?1015h');`); - - // test at 0,0 - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [{col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - // mouseup should not report - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), []); - - // mousemove should not report - await mouseMove(50, 10); - assert.deepEqual(await getReports(encoding), []); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [{col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - // test at max rows/cols - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [{col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - // middle button - // bug: default action not cancelled (adds data to getReports from clipboard under X11) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]); - // right button - // bug: default action not cancelled (popup shown) - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('right'); - await mouseMove(44, 24); - await mouseUp('right'); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), []); - await wheelDown(); - assert.deepEqual(await getReports(encoding), []); - - // modifiers - // CTRL - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}]); - - // ALT await mouseMove(43, 24); await getReports(encoding); // clear reports @@ -889,155 +639,6 @@ describe('Mouse Tracking Tests', function(): void { {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); }); - it.skip('UTF8 encoding', async () => { - const encoding = 'UTF8'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?1000h\x1b[?1005h');`); - - // test at 0,0 - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mouseup should report, encoding cannot report released button - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mousemove should not report - await mouseMove(50, 10); - assert.deepEqual(await getReports(encoding), []); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 51, row: 11, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // test at max rows/cols - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - // middle button - // bug: default action not cancelled (adds data to getReports from clipboard under X11) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]); - // right button - // bug: default action not cancelled (popup shown) - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('right'); - await mouseMove(44, 24); - await mouseUp('right'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - await wheelDown(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - - // modifiers - // CTRL - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} - ]); - - // ALT - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Alt'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Alt'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} - ]); - - // SHIFT - // note: press/release caught by selection manager - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Shift'); // defaults to ShiftLeft - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Shift'); - if (noShift) { - assert.deepEqual(await getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} - ]); - } else { - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} - ]); - } - - // all modifiers - // bug: Shift not working - selection manager? - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await page.keyboard.down('Alt'); - // await page.keyboard.down('Shift'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - await page.keyboard.up('Alt'); - // await page.keyboard.up('Shift'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} - ]); - }); it('SGR encoding', async () => { const encoding = 'SGR'; await resetMouseModes(); @@ -1187,155 +788,6 @@ describe('Mouse Tracking Tests', function(): void { {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); }); - it.skip('URXVT encoding', async () => { - const encoding = 'URXVT'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?1000h\x1b[?1015h');`); - - // test at 0,0 - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mouseup should report, encoding cannot report released button - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mousemove should not report - await mouseMove(50, 10); - assert.deepEqual(await getReports(encoding), []); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 51, row: 11, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // test at max rows/cols - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - // middle button - // bug: default action not cancelled (adds data to getReports from clipboard under X11) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]); - // right button - // bug: default action not cancelled (popup shown) - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('right'); - await mouseMove(44, 24); - await mouseUp('right'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - await wheelDown(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - - // modifiers - // CTRL - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} - ]); - - // ALT - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Alt'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Alt'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} - ]); - - // SHIFT - // note: press/release caught by selection manager - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Shift'); // defaults to ShiftLeft - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Shift'); - if (noShift) { - assert.deepEqual(await getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} - ]); - } else { - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} - ]); - } - - // all modifiers - // bug: Shift not working - selection manager? - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await page.keyboard.down('Alt'); - // await page.keyboard.down('Shift'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - await page.keyboard.up('Alt'); - // await page.keyboard.up('Shift'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} - ]); - }); }); describe('DECSET 1002 (xterm with drag)', () => { /** @@ -1502,164 +954,6 @@ describe('Mouse Tracking Tests', function(): void { {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); }); - it.skip('UTF8 encoding', async () => { - const encoding = 'UTF8'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?1002h\x1b[?1005h');`); - - // test at 0,0 - // bug: release is fired immediately - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mouseup should report, encoding cannot report released button - // bug: release already fired thus no event here - expected: release event - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mousemove should not report - await mouseMove(50, 10); - assert.deepEqual(await getReports(encoding), []); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 51, row: 11, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // test at max rows/cols - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - // middle button - // bug: default action not cancelled (adds data to getReports from clipboard under X11) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]); - // right button - // bug: default action not cancelled (popup shown) - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('right'); - await mouseMove(44, 24); - await mouseUp('right'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - await wheelDown(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - - // modifiers - // CTRL - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} - ]); - - // ALT - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Alt'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Alt'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} - ]); - - // SHIFT - // note: press/release/drag caught by selection manager - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Shift'); // defaults to ShiftLeft - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Shift'); - if (noShift) { - assert.deepEqual(await getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} - ]); - } else { - // bug: completely messed up - wrong modifier, only partially reported - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} - ]); - } - - // all modifiers - // bug: Shift not working - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await page.keyboard.down('Alt'); - // await page.keyboard.down('Shift'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - await page.keyboard.up('Alt'); - // await page.keyboard.up('Shift'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} - ]); - }); it('SGR encoding', async () => { const encoding = 'SGR'; await resetMouseModes(); @@ -1816,162 +1110,6 @@ describe('Mouse Tracking Tests', function(): void { {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); }); - it.skip('URXVT encoding', async () => { - const encoding = 'URXVT'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?1002h\x1b[?1015h');`); - - // test at 0,0 - // bug: release is fired immediately - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mouseup should report, encoding cannot report released button - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mousemove should not report - await mouseMove(50, 10); - assert.deepEqual(await getReports(encoding), []); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 51, row: 11, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // test at max rows/cols - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - // middle button - // bug: default action not cancelled (adds data to getReports from clipboard under X11) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]); - // right button - // bug: default action not cancelled (popup shown) - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await mouseDown('right'); - await mouseMove(44, 24); - await mouseUp('right'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - await wheelDown(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - - // modifiers - // CTRL - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} - ]); - - // ALT - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Alt'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Alt'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} - ]); - - // SHIFT - // note: press/release/drag caught by selection manager - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Shift'); // defaults to ShiftLeft - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Shift'); - if (noShift) { - assert.deepEqual(await getReports(encoding), [ - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} - ]); - } else { - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} - ]); - } - - // all modifiers - // bug: Shift not working - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await page.keyboard.down('Control'); - await page.keyboard.down('Alt'); - // await page.keyboard.down('Shift'); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - await page.keyboard.up('Alt'); - // await page.keyboard.up('Shift'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} - ]); - }); }); describe('DECSET 1003 (xterm any event)', () => { /** @@ -2139,167 +1277,6 @@ describe('Mouse Tracking Tests', function(): void { {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); }); - it.skip('UTF8 encoding', async () => { - const encoding = 'UTF8'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?1003h\x1b[?1005h');`); - - // test at 0,0 - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mouseup should report, encoding cannot report released button - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mousemove should report - await mouseMove(50, 10); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 51, row: 11, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // test at max rows/cols - // bug: we are capped at col 95 currently - // fix: allow values up to 223, any bigger should drop to 0 - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: cols, row: rows, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - // middle button - // bug: default action not cancelled (adds data to getReports from clipboard under X11) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]); - // right button - // bug: default action not cancelled (popup shown) - await mouseMove(43, 24); - await mouseDown('right'); - await mouseMove(44, 24); - await mouseUp('right'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - await wheelDown(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - - // modifiers - // CTRL - await page.keyboard.down('Control'); - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: true, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} - ]); - - // ALT - await page.keyboard.down('Alt'); - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Alt'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: true}}}, - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} - ]); - - // SHIFT - // note: press/release/drag caught by selection manager - await page.keyboard.down('Shift'); - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Shift'); - if (noShift) { - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} - ]); - } else { - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} - ]); - } - - // all modifiers - // bug: Shift not working - await page.keyboard.down('Control'); - await page.keyboard.down('Alt'); - // await page.keyboard.down('Shift'); - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - await page.keyboard.up('Alt'); - // await page.keyboard.up('Shift'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: true, shift: false, meta: true}}}, - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} - ]); - }); it('SGR encoding', async () => { const encoding = 'SGR'; await resetMouseModes(); @@ -2461,167 +1438,6 @@ describe('Mouse Tracking Tests', function(): void { {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} ]); }); - it.skip('URXVT encoding', async () => { - const encoding = 'URXVT'; - await resetMouseModes(); - await mouseMove(0, 0); - await page.evaluate(`window.term.write('\x1b[?1003h\x1b[?1015h');`); - - // test at 0,0 - await mouseDown('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mouseup should report, encoding cannot report released button - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 1, row: 1, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // mousemove should report - await mouseMove(50, 10); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 51, row: 11, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 51, row: 11, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // test at max rows/cols - // bug: we are capped at col 95 currently - // fix: allow values up to 223, any bigger should drop to 0 - await mouseMove(cols - 1, rows - 1); - await mouseDown('left'); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: cols, row: rows, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: cols, row: rows, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // button press/move/release tests - // left button - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - // middle button - // bug: default action not cancelled (adds data to getReports from clipboard under X11) - // await mouseMove(43, 24); - // await getReports(encoding); // clear reports - // await mouseDown('middle'); - // await mouseMove(44, 24); - // await mouseUp('middle'); - // assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'press', button: 'middle', modifier: {control: false, shift: false, meta: false}}}]); - // right button - // bug: default action not cancelled (popup shown) - await mouseMove(43, 24); - await mouseDown('right'); - await mouseMove(44, 24); - await mouseUp('right'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'press', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'right', modifier: {control: false, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: false}}} - ]); - - // wheel - await mouseMove(43, 24); - await getReports(encoding); // clear reports - await wheelUp(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'up', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - await wheelDown(); - assert.deepEqual(await getReports(encoding), [{col: 44, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: false}}}]); - - // modifiers - // CTRL - await page.keyboard.down('Control'); - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: true, shift: false, meta: false}}}, - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: false}}} - ]); - - // ALT - await page.keyboard.down('Alt'); - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Alt'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: false, meta: true}}}, - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: false, meta: true}}} - ]); - - // SHIFT - // note: press/release/drag caught by selection manager - await page.keyboard.down('Shift'); - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Shift'); - if (noShift) { - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} - ]); - } else { - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: false, shift: true, meta: false}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: false, shift: true, meta: false}}} - ]); - } - - // all modifiers - // bug: Shift not working - await page.keyboard.down('Control'); - await page.keyboard.down('Alt'); - // await page.keyboard.down('Shift'); - await mouseMove(43, 24); - await mouseDown('left'); - await mouseMove(44, 24); - await mouseUp('left'); - await wheelDown(); - await page.keyboard.up('Control'); - await page.keyboard.up('Alt'); - // await page.keyboard.up('Shift'); - assert.deepEqual(await getReports(encoding), [ - {col: 44, row: 25, state: {action: 'move', button: '', modifier: {control: true, shift: false, meta: true}}}, - {col: 44, row: 25, state: {action: 'press', button: 'left', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'move', button: 'left', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'release', button: '', modifier: {control: true, shift: false, meta: true}}}, - {col: 45, row: 25, state: {action: 'down', button: 'wheel', modifier: {control: true, shift: false, meta: true}}} - ]); - }); }); /** * move tests with multiple buttons pressed: From 13ddaf8f988a5332d7f828d2c76c50837e193844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Thu, 24 Oct 2019 22:32:10 +0200 Subject: [PATCH 03/25] limit parse buffer size --- src/InputHandler.test.ts | 18 ++++++++++++++++++ src/InputHandler.ts | 29 ++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/src/InputHandler.test.ts b/src/InputHandler.test.ts index ca63bdae..d8defa1c 100644 --- a/src/InputHandler.test.ts +++ b/src/InputHandler.test.ts @@ -1248,4 +1248,22 @@ describe('InputHandler', () => { assert.deepEqual(getLines(term, term.rows + 1), ['12345', '125', '125', '125', '125', '125']); }); }); + it('should parse big chunks in smaller subchunks', () => { + // max single chunk size is hardcoded as 131072 + const calls: any[] = []; + const term = new TestTerminal({cols: 10, rows: 10}); + (term as any)._inputHandler._parser.parse = (data: Uint32Array, length: number) => { + calls.push([data.length, length]); + }; + term.writeSync('12345'); + term.writeSync('a'.repeat(10000)); + term.writeSync('a'.repeat(200000)); + term.writeSync('a'.repeat(300000)); + assert.deepEqual(calls, [ + [4096, 5], + [10000, 10000], + [131072, 131072], [131072, 200000 - 131072], + [131072, 131072], [131072, 131072], [131072, 300000 - 131072 - 131072] + ]); + }); }); diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 21ad8ea0..f0f8d147 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -28,6 +28,11 @@ import { DcsHandler } from 'common/parser/DcsParser'; */ const GLEVEL: {[key: string]: number} = {'(': 0, ')': 1, '*': 2, '+': 3, '-': 1, '.': 2}; +/** + * Max length of the UTF32 input buffer. Real memory consumption is 4 times higher. + */ +const MAX_PARSEBUFFER_LENGTH = 131072; + /** * DCS subparser implementations @@ -335,14 +340,28 @@ export class InputHandler extends Disposable implements IInputHandler { this._logService.debug('parsing data', data); + // resize input buffer if needed if (this._parseBuffer.length < data.length) { - this._parseBuffer = new Uint32Array(data.length); + if (this._parseBuffer.length < MAX_PARSEBUFFER_LENGTH) { + this._parseBuffer = new Uint32Array(Math.min(data.length, MAX_PARSEBUFFER_LENGTH)); + } } - this._parser.parse(this._parseBuffer, - (typeof data === 'string') + + // process big data in smaller chunks + if (data.length > MAX_PARSEBUFFER_LENGTH) { + for (let i = 0; i < data.length; i += MAX_PARSEBUFFER_LENGTH) { + const end = i + MAX_PARSEBUFFER_LENGTH < data.length ? i + MAX_PARSEBUFFER_LENGTH : data.length; + const len = (typeof data === 'string') + ? this._stringDecoder.decode(data.substring(i, end), this._parseBuffer) + : this._utf8Decoder.decode(data.subarray(i, end), this._parseBuffer); + this._parser.parse(this._parseBuffer, len); + } + } else { + const len = (typeof data === 'string') ? this._stringDecoder.decode(data, this._parseBuffer) - : this._utf8Decoder.decode(data, this._parseBuffer) - ); + : this._utf8Decoder.decode(data, this._parseBuffer); + this._parser.parse(this._parseBuffer, len); + } buffer = this._bufferService.buffer; if (buffer.x !== cursorStartX || buffer.y !== cursorStartY) { From 31be1ebc533ad2fdf807e0a5e2218d049fad1cc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Fri, 25 Oct 2019 12:41:31 +0200 Subject: [PATCH 04/25] remove DECSET 1005 and 1015 from InputHandler --- src/InputHandler.ts | 18 ++++++++---------- src/common/services/CoreMouseService.test.ts | 2 +- src/common/services/CoreMouseService.ts | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 74358583..1b384660 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -1321,16 +1321,14 @@ export class InputHandler extends Disposable implements IInputHandler { // focusout: ^[[O this._terminal.sendFocus = true; break; - case 1005: // utf8 ext mode mouse - // for wide terminals - // simply encodes large values as utf8 characters - this._coreMouseService.activeEncoding = 'UTF8'; + case 1005: // utf8 ext mode mouse - removed in #2507 + this._logService.debug('DECSET 1005 not supported (see #2507)'); break; case 1006: // sgr ext mode mouse this._coreMouseService.activeEncoding = 'SGR'; break; - case 1015: // urxvt ext mode mouse - this._coreMouseService.activeEncoding = 'URXVT'; + case 1015: // urxvt ext mode mouse - removed in #2507 + this._logService.debug('DECSET 1005 not supported (see #2507)'); break; case 25: // show cursor this._terminal.cursorHidden = false; @@ -1494,14 +1492,14 @@ export class InputHandler extends Disposable implements IInputHandler { case 1004: // send focusin/focusout events this._terminal.sendFocus = false; break; - case 1005: // utf8 ext mode mouse - this._coreMouseService.activeEncoding = 'DEFAULT'; + case 1005: // utf8 ext mode mouse - removed in #2507 + this._logService.debug('DECRST 1005 not supported (see #2507)'); break; case 1006: // sgr ext mode mouse this._coreMouseService.activeEncoding = 'DEFAULT'; break; - case 1015: // urxvt ext mode mouse - this._coreMouseService.activeEncoding = 'DEFAULT'; + case 1015: // urxvt ext mode mouse - removed in #2507 + this._logService.debug('DECRST 1015 not supported (see #2507)'); break; case 25: // hide cursor this._terminal.cursorHidden = true; diff --git a/src/common/services/CoreMouseService.test.ts b/src/common/services/CoreMouseService.test.ts index 71d06da5..f7d3bf83 100644 --- a/src/common/services/CoreMouseService.test.ts +++ b/src/common/services/CoreMouseService.test.ts @@ -32,7 +32,7 @@ describe('CoreMouseService', () => { const cms = new CoreMouseService(bufferService, coreService); assert.deepEqual(Object.keys((cms as any)._protocols), ['NONE', 'X10', 'VT200', 'DRAG', 'ANY']); }); - it('default encodings - DEFAULT, UTF8, SGR, URXVT', () => { + it('default encodings - DEFAULT, SGR', () => { const cms = new CoreMouseService(bufferService, coreService); assert.deepEqual(Object.keys((cms as any)._encodings), ['DEFAULT', 'SGR']); }); diff --git a/src/common/services/CoreMouseService.ts b/src/common/services/CoreMouseService.ts index 19852d16..500655b9 100644 --- a/src/common/services/CoreMouseService.ts +++ b/src/common/services/CoreMouseService.ts @@ -148,7 +148,7 @@ const DEFAULT_ENCODINGS: {[key: string]: CoreMouseEncoding} = { * * Provides mouse tracking reports with different protocols and encodings. * - protocols: NONE (default), X10, VT200, DRAG, ANY - * - encodings: DEFAULT, SGR, UTF8, URXVT + * - encodings: DEFAULT, SGR (UTF8, URXVT removed in #2507) * * Custom protocols/encodings can be added by `addProtocol` / `addEncoding`. * To activate a protocol/encoding, set `activeProtocol` / `activeEncoding`. From ee2c1f71ef2180111d9df4d3d2c3ed6ff44094ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Fri, 25 Oct 2019 12:43:34 +0200 Subject: [PATCH 05/25] fix typo in debug msg --- src/InputHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/InputHandler.ts b/src/InputHandler.ts index 3ede2bed..7b6ea1fe 100644 --- a/src/InputHandler.ts +++ b/src/InputHandler.ts @@ -1441,7 +1441,7 @@ export class InputHandler extends Disposable implements IInputHandler { this._coreMouseService.activeEncoding = 'SGR'; break; case 1015: // urxvt ext mode mouse - removed in #2507 - this._logService.debug('DECSET 1005 not supported (see #2507)'); + this._logService.debug('DECSET 1015 not supported (see #2507)'); break; case 25: // show cursor this._terminal.cursorHidden = false; From 67e5974eee035d338b4135ac1fdde298460906d6 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 25 Oct 2019 04:04:17 -0700 Subject: [PATCH 06/25] Set disposed marker line to -1 Another indicator that it's disposed/invalid --- src/common/buffer/Marker.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/buffer/Marker.ts b/src/common/buffer/Marker.ts index 7f52ac99..9a4256d3 100644 --- a/src/common/buffer/Marker.ts +++ b/src/common/buffer/Marker.ts @@ -29,6 +29,7 @@ export class Marker extends Disposable implements IMarker { return; } this.isDisposed = true; + this.line = -1; // Emit before super.dispose such that dispose listeners get a change to react this._onDispose.fire(); } From dac2da05bf1d3ccdc19f17296e49d6c53ff612d7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 25 Oct 2019 04:13:03 -0700 Subject: [PATCH 07/25] Clarify marker API docs --- typings/xterm.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 62670f3d..7d19283f 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -325,7 +325,8 @@ declare module 'xterm' { /** * Represents a specific line in the terminal that is tracked when scrollback - * is trimmed and lines are added or removed. + * is trimmed and lines are added or removed. This is a single line that may + * be part of a larger wrapped line. */ export interface IMarker extends IDisposable { /** @@ -339,7 +340,8 @@ declare module 'xterm' { readonly isDisposed: boolean; /** - * The actual line index in the buffer at this point in time. + * The actual line index in the buffer at this point in time. This is set to + * -1 if the marker has been disposed. */ readonly line: number; } From 851fb7ae381eac879af89bdc5c2a705867d4dae1 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 25 Oct 2019 04:43:34 -0700 Subject: [PATCH 08/25] Refine IViewportRange API to use 'cursor positions' for x value Fixes #2484 --- src/browser/Linkifier.ts | 2 +- src/browser/Types.d.ts | 10 +++++----- typings/xterm.d.ts | 23 ++++++++++++++--------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/browser/Linkifier.ts b/src/browser/Linkifier.ts index ecaf8af9..58aca70e 100644 --- a/src/browser/Linkifier.ts +++ b/src/browser/Linkifier.ts @@ -308,7 +308,7 @@ export class Linkifier implements ILinkifier { if (matcher.hoverTooltipCallback) { // Note that IViewportRange use 1-based coordinates to align with escape sequences such // as CUP which use 1,1 as the default for row/col - matcher.hoverTooltipCallback(e, uri, { start: { row: y1 + 1, col: x1 + 1 }, end: { row: y2 + 1, col: x2 } }); + matcher.hoverTooltipCallback(e, uri, { start: { x: x1, y: y1 }, end: { x: x2, y: y2 } }); } }, () => { diff --git a/src/browser/Types.d.ts b/src/browser/Types.d.ts index 274fc16f..aa7a4c86 100644 --- a/src/browser/Types.d.ts +++ b/src/browser/Types.d.ts @@ -44,13 +44,13 @@ export interface IViewport extends IDisposable { } export interface IViewportRange { - start: IViewportCellPosition; - end: IViewportCellPosition; + start: IViewportRangePosition; + end: IViewportRangePosition; } -export interface IViewportCellPosition { - col: number; - row: number; +export interface IViewportRangePosition { + x: number; + y: number; } export type LinkMatcherHandler = (event: MouseEvent, uri: string) => void; diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 62670f3d..f5435cca 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -862,29 +862,34 @@ declare module 'xterm' { */ export interface IViewportRange { /** - * The start cell of the range. + * The start of the range. */ - start: IViewportCellPosition; + start: IViewportRangePosition; /** - * The end cell of the range. + * The end of the range. */ - end: IViewportCellPosition; + end: IViewportRangePosition; } /** * An object representing a cell position within the viewport of the terminal. */ - interface IViewportCellPosition { + interface IViewportRangePosition { /** - * The column of the cell. Note that this is 1-based; the first column is column 1. + * The x position of the cell. This is a 0-based index that refers to the + * space in between columns, not the column itself. Index 0 refers to the + * left side of the viewport, index `Terminal.cols` refers to the right side + * of the viewport. This can be thought of as how a cursor is positioned in + * a text editor. */ - col: number; + x: number; /** - * The row of the cell. Note that this is 1-based; the first row is row 1. + * The y position of the cell. This is a 0-based index that refers to a + * specific row. */ - row: number; + y: number; } /** From a5a0779aa9a1badc0ee837db95a1ac84c48b39a2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 25 Oct 2019 05:22:03 -0700 Subject: [PATCH 09/25] Apply scrollSensitivity on fast scroll too Fixes #2513 --- src/browser/Viewport.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/browser/Viewport.ts b/src/browser/Viewport.ts index 5edd7b80..b88f381d 100644 --- a/src/browser/Viewport.ts +++ b/src/browser/Viewport.ts @@ -237,7 +237,7 @@ export class Viewport extends Disposable implements IViewport { if ((modifier === 'alt' && ev.altKey) || (modifier === 'ctrl' && ev.ctrlKey) || (modifier === 'shift' && ev.shiftKey)) { - return amount * this._optionsService.options.fastScrollSensitivity; + return amount * this._optionsService.options.fastScrollSensitivity * this._optionsService.options.scrollSensitivity; } return amount * this._optionsService.options.scrollSensitivity; From bfe11b708100c6a8cda5fcddec2f6c853c8b5bfe Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 25 Oct 2019 05:38:17 -0700 Subject: [PATCH 10/25] v4.2.0 --- addons/xterm-addon-fit/package.json | 2 +- addons/xterm-addon-search/package.json | 2 +- addons/xterm-addon-webgl/package.json | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/xterm-addon-fit/package.json b/addons/xterm-addon-fit/package.json index fa1bf852..4bceb258 100644 --- a/addons/xterm-addon-fit/package.json +++ b/addons/xterm-addon-fit/package.json @@ -1,6 +1,6 @@ { "name": "xterm-addon-fit", - "version": "0.2.1", + "version": "0.3.0", "author": { "name": "The xterm.js authors", "url": "https://xtermjs.org/" diff --git a/addons/xterm-addon-search/package.json b/addons/xterm-addon-search/package.json index c2e14032..c426ee3b 100644 --- a/addons/xterm-addon-search/package.json +++ b/addons/xterm-addon-search/package.json @@ -1,6 +1,6 @@ { "name": "xterm-addon-search", - "version": "0.2.1", + "version": "0.3.0", "author": { "name": "The xterm.js authors", "url": "https://xtermjs.org/" diff --git a/addons/xterm-addon-webgl/package.json b/addons/xterm-addon-webgl/package.json index 9a01aea0..a6befe08 100644 --- a/addons/xterm-addon-webgl/package.json +++ b/addons/xterm-addon-webgl/package.json @@ -1,6 +1,6 @@ { "name": "xterm-addon-webgl", - "version": "0.2.1", + "version": "0.3.0", "author": { "name": "The xterm.js authors", "url": "https://xtermjs.org/" diff --git a/package.json b/package.json index 709a1415..8174bbf5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "xterm", "description": "Full xterm terminal, in your browser", - "version": "4.1.0", + "version": "4.2.0", "main": "lib/xterm.js", "style": "css/xterm.css", "types": "typings/xterm.d.ts", From 25c18e8e07d4d08f8ea2178e1e730799d655149f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Fri, 25 Oct 2019 17:29:38 +0200 Subject: [PATCH 11/25] conditional build for addons --- bin/install-addons.js | 40 ++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 41 insertions(+) create mode 100644 bin/install-addons.js diff --git a/bin/install-addons.js b/bin/install-addons.js new file mode 100644 index 00000000..b042552a --- /dev/null +++ b/bin/install-addons.js @@ -0,0 +1,40 @@ +const path = require('path'); +const cp = require('child_process'); +const fs = require('fs'); + +const PACKAGE_ROOT = path.join(__dirname, '..'); + +// install addon deps +const addonsPath = path.join(PACKAGE_ROOT, 'addons'); +if (fs.existsSync(addonsPath)) { + console.log('pulling addon dependencies...'); + + // whether to use yarn or npm + let hasYarn = false; + try { + cp.execSync('yarn --version').toString(); + hasYarn = true; + } catch(e) {} + + // walk all addon folders + fs.readdir(addonsPath, (err, files) => { + files.forEach(folder => { + const addonPath = path.join(addonsPath, folder); + + // install only if there are dependencies listed + const packageJson = require(path.join(addonPath, 'package.json')); + if ((packageJson.devDependencies && Object.keys(packageJson.devDependencies).length) + || (packageJson.dependencies && Object.keys(packageJson.dependencies).length)) + { + console.log('Preparing', folder); + if (hasYarn) { + cp.execSync('yarn', {cwd: addonPath}); + } else { + cp.execSync('npm install', {cwd: addonPath}); + } + } else { + console.log('Skipped', folder); + } + }); + }); +} diff --git a/package.json b/package.json index 8174bbf5..773d954a 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "repository": "https://github.com/xtermjs/xterm.js", "license": "MIT", "scripts": { + "postinstall": "node -e \"try { require('./bin/install-addons'); } catch(e) {}\"", "prepackage": "npm run build", "package": "webpack", "start": "node demo/start", From 6f8cbc56ebfd7e53c7e611244fe04017c13ccf86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Fri, 25 Oct 2019 18:07:32 +0200 Subject: [PATCH 12/25] skip folder w'o package.json; restrict linter to src folders --- bin/install-addons.js | 15 ++++++++++++--- package.json | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bin/install-addons.js b/bin/install-addons.js index b042552a..0a3ebe0c 100644 --- a/bin/install-addons.js +++ b/bin/install-addons.js @@ -22,9 +22,18 @@ if (fs.existsSync(addonsPath)) { const addonPath = path.join(addonsPath, folder); // install only if there are dependencies listed - const packageJson = require(path.join(addonPath, 'package.json')); - if ((packageJson.devDependencies && Object.keys(packageJson.devDependencies).length) - || (packageJson.dependencies && Object.keys(packageJson.dependencies).length)) + // also skip addon if it does not contain any package.json + // (might happen after branch switches) + let packageJson; + try { + packageJson = require(path.join(addonPath, 'package.json')); + } catch (e) {} + if (packageJson + && ( + (packageJson.devDependencies && Object.keys(packageJson.devDependencies).length) + || (packageJson.dependencies && Object.keys(packageJson.dependencies).length) + ) + ) { console.log('Preparing', folder); if (hasYarn) { diff --git a/package.json b/package.json index 773d954a..7762cd84 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "prepackage": "npm run build", "package": "webpack", "start": "node demo/start", - "lint": "tslint 'src/**/*.ts' 'addons/**/*.ts'", + "lint": "tslint 'src/**/*.ts' 'addons/*/src/**/*.ts'", "test": "npm run test-unit", "posttest": "npm run lint", "test-api": "mocha \"**/*.api.js\"", From d733ce3e63d74a0ec4f02630fb241d7c2dab8569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Fri, 25 Oct 2019 19:27:29 +0200 Subject: [PATCH 13/25] add copyright note --- bin/install-addons.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/install-addons.js b/bin/install-addons.js index 0a3ebe0c..bba0a9ea 100644 --- a/bin/install-addons.js +++ b/bin/install-addons.js @@ -1,3 +1,10 @@ +/** + * Copyright (c) 2019 The xterm.js authors. All rights reserved. + * @license MIT + * + * Script to initialize addon packages under "addons/" with outer deps. + */ + const path = require('path'); const cp = require('child_process'); const fs = require('fs'); From 04f828bc1aa1bf463bf325fd22d8442f75052d44 Mon Sep 17 00:00:00 2001 From: jerch Date: Fri, 25 Oct 2019 21:46:49 +0200 Subject: [PATCH 14/25] Update bin/install-addons.js Co-Authored-By: Daniel Imms --- bin/install-addons.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/install-addons.js b/bin/install-addons.js index bba0a9ea..23ae445a 100644 --- a/bin/install-addons.js +++ b/bin/install-addons.js @@ -34,7 +34,9 @@ if (fs.existsSync(addonsPath)) { let packageJson; try { packageJson = require(path.join(addonPath, 'package.json')); - } catch (e) {} + } catch (e) { + // swallow as changing branches can leave folders around + } if (packageJson && ( (packageJson.devDependencies && Object.keys(packageJson.devDependencies).length) From 03435a9f4d8542a0f05884f983875758bb4fc68a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Fri, 25 Oct 2019 22:11:51 +0200 Subject: [PATCH 15/25] use prebuild instead of postinstall --- bin/install-addons.js | 2 -- package.json | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/install-addons.js b/bin/install-addons.js index 23ae445a..83adea1f 100644 --- a/bin/install-addons.js +++ b/bin/install-addons.js @@ -29,8 +29,6 @@ if (fs.existsSync(addonsPath)) { const addonPath = path.join(addonsPath, folder); // install only if there are dependencies listed - // also skip addon if it does not contain any package.json - // (might happen after branch switches) let packageJson; try { packageJson = require(path.join(addonPath, 'package.json')); diff --git a/package.json b/package.json index 7762cd84..1bc7861e 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,6 @@ "repository": "https://github.com/xtermjs/xterm.js", "license": "MIT", "scripts": { - "postinstall": "node -e \"try { require('./bin/install-addons'); } catch(e) {}\"", "prepackage": "npm run build", "package": "webpack", "start": "node demo/start", @@ -17,6 +16,7 @@ "posttest": "npm run lint", "test-api": "mocha \"**/*.api.js\"", "test-unit": "node ./bin/test.js", + "prebuild": "node ./bin/install-addons.js", "build": "tsc -b ./tsconfig.all.json", "prepare": "npm run build", "prepublishOnly": "npm run package", From 5b3a093f13aded3d5165634fd109088b17dd303d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Breitbart?= Date: Sat, 26 Oct 2019 17:20:35 +0200 Subject: [PATCH 16/25] stick to prepare to avoid re-running yarn for addons everytime during build --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1bc7861e..fb9592c7 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,10 @@ "posttest": "npm run lint", "test-api": "mocha \"**/*.api.js\"", "test-unit": "node ./bin/test.js", - "prebuild": "node ./bin/install-addons.js", "build": "tsc -b ./tsconfig.all.json", - "prepare": "npm run build", + "prepare": "npm run setup", + "setup": "npm run build", + "presetup": "node ./bin/install-addons.js", "prepublishOnly": "npm run package", "watch": "tsc -b -w ./tsconfig.all.json --preserveWatchOutput", "benchmark": "NODE_PATH=./out xterm-benchmark -r 5 -c test/benchmark/benchmark.json", From d0e05eb795c6ab4a22b3dc00ffb3f2e6e8de3e80 Mon Sep 17 00:00:00 2001 From: Revanth Mahesh Date: Sun, 27 Oct 2019 10:11:43 +0530 Subject: [PATCH 17/25] Support disposing of EventEmitters --- src/common/EventEmitter.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/common/EventEmitter.ts b/src/common/EventEmitter.ts index 34ac190f..ea9df48b 100644 --- a/src/common/EventEmitter.ts +++ b/src/common/EventEmitter.ts @@ -16,11 +16,13 @@ export interface IEvent { export interface IEventEmitter { event: IEvent; fire(data: T): void; + dispose(): void; } export class EventEmitter implements IEventEmitter { private _listeners: IListener[] = []; private _event?: IEvent; + private _disposed: boolean = false; public get event(): IEvent { if (!this._event) { @@ -28,10 +30,12 @@ export class EventEmitter implements IEventEmitter { this._listeners.push(listener); const disposable = { dispose: () => { - for (let i = 0; i < this._listeners.length; i++) { - if (this._listeners[i] === listener) { - this._listeners.splice(i, 1); - return; + if (!this._disposed) { + for (let i = 0; i < this._listeners.length; i++) { + if (this._listeners[i] === listener) { + this._listeners.splice(i, 1); + return; + } } } } @@ -51,4 +55,12 @@ export class EventEmitter implements IEventEmitter { queue[i].call(undefined, data); } } + +public dispose(): void { + if (this._listeners) { + this._listeners.splice(0, this._listeners.length); + } + this._disposed = true; +} + } From f3bbcb35e4421c112d81f66f0ea1f3286e8e5ed4 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Sat, 26 Oct 2019 21:52:11 -0700 Subject: [PATCH 18/25] Clean up --- src/common/EventEmitter.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/common/EventEmitter.ts b/src/common/EventEmitter.ts index ea9df48b..5991e338 100644 --- a/src/common/EventEmitter.ts +++ b/src/common/EventEmitter.ts @@ -56,11 +56,10 @@ export class EventEmitter implements IEventEmitter { } } -public dispose(): void { - if (this._listeners) { - this._listeners.splice(0, this._listeners.length); + public dispose(): void { + if (this._listeners) { + this._listeners.length = 0; + } + this._disposed = true; } - this._disposed = true; -} - } From 56d33668310397948dcfeb6324ac1d518ebb11bf Mon Sep 17 00:00:00 2001 From: alberto Date: Sun, 27 Oct 2019 22:08:42 +0100 Subject: [PATCH 19/25] Fix typo --- addons/xterm-addon-search/typings/xterm-addon-search.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/xterm-addon-search/typings/xterm-addon-search.d.ts b/addons/xterm-addon-search/typings/xterm-addon-search.d.ts index 94bc5297..913f33df 100644 --- a/addons/xterm-addon-search/typings/xterm-addon-search.d.ts +++ b/addons/xterm-addon-search/typings/xterm-addon-search.d.ts @@ -27,7 +27,7 @@ declare module 'xterm-addon-search' { caseSensitive?: boolean; /** - * Whether to do an indcremental search, this will expand the selection if it + * Whether to do an incremental search, this will expand the selection if it * still matches the term the user typed. Note that this only affects * `findNext`, not `findPrevious`. */ From dca1e0b93549a155fef5b6e82532f6be6552957f Mon Sep 17 00:00:00 2001 From: alberto Date: Sun, 27 Oct 2019 22:18:11 +0100 Subject: [PATCH 20/25] Fix another typo --- addons/xterm-addon-search/typings/xterm-addon-search.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/xterm-addon-search/typings/xterm-addon-search.d.ts b/addons/xterm-addon-search/typings/xterm-addon-search.d.ts index 913f33df..f27aba78 100644 --- a/addons/xterm-addon-search/typings/xterm-addon-search.d.ts +++ b/addons/xterm-addon-search/typings/xterm-addon-search.d.ts @@ -17,7 +17,7 @@ declare module 'xterm-addon-search' { /** * Whether to search for a whole word, the result is only valid if it's - * suppounded in "non-word" characters such as `_`, `(`, `)` or space. + * surrounded in "non-word" characters such as `_`, `(`, `)` or space. */ wholeWord?: boolean; From 8d0fdc8731b823968e991eb8b98588f5577407ab Mon Sep 17 00:00:00 2001 From: alberto Date: Sun, 27 Oct 2019 22:29:36 +0100 Subject: [PATCH 21/25] Fix grammar --- typings/xterm.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 295a03b2..27f39177 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -49,7 +49,7 @@ declare module 'xterm' { /** * When enabled the cursor will be set to the beginning of the next line - * with every new line. This equivalent to sending '\r\n' for each '\n'. + * with every new line. This is equivalent to sending '\r\n' for each '\n'. * Normally the termios settings of the underlying PTY deals with the * translation of '\n' to '\r\n' and this setting should not be used. If you * deal with data from a non-PTY related source, this settings might be From fe2ac04b857e730f62780e55ebf1d672890510b7 Mon Sep 17 00:00:00 2001 From: alberto Date: Sun, 27 Oct 2019 22:34:54 +0100 Subject: [PATCH 22/25] Fix grammar --- typings/xterm.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 27f39177..eb9904e8 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -437,7 +437,7 @@ declare module 'xterm' { onData: IEvent; /** - * Adds an event listener for a key is pressed. The event value contains the + * Adds an event listener for when a key is pressed. The event value contains the * string that will be sent in the data event as well as the DOM event that * triggered it. * @returns an `IDisposable` to stop listening. From ffe2d66affe663c5bb861a92c28517f19e90c5be Mon Sep 17 00:00:00 2001 From: alberto Date: Sun, 27 Oct 2019 22:38:55 +0100 Subject: [PATCH 23/25] Remove duplicated punctuation --- typings/xterm.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index eb9904e8..9ec407c7 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -609,7 +609,7 @@ declare module 'xterm' { /** * Selects text within the terminal. - * @param column The column the selection starts at.. + * @param column The column the selection starts at. * @param row The row the selection starts at. * @param length The length of the selection. */ From b880cd3ad3d171023bcb11caf708f6ec7d7c1f6c Mon Sep 17 00:00:00 2001 From: alberto Date: Sun, 27 Oct 2019 22:43:26 +0100 Subject: [PATCH 24/25] Fix punctuation mark --- typings/xterm.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index 9ec407c7..eb2b3a7f 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -918,7 +918,7 @@ declare module 'xterm' { /** * The line within the buffer where the top of the bottom page is (when - * fully scrolled down); + * fully scrolled down). */ readonly baseY: number; From cb1cf3cd119d500d5ac099548a5d5394fc061e03 Mon Sep 17 00:00:00 2001 From: alberto Date: Sun, 27 Oct 2019 22:50:22 +0100 Subject: [PATCH 25/25] Fix grammar --- typings/xterm.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/typings/xterm.d.ts b/typings/xterm.d.ts index eb2b3a7f..9728a72c 100644 --- a/typings/xterm.d.ts +++ b/typings/xterm.d.ts @@ -1047,7 +1047,7 @@ declare module 'xterm' { * array will contain subarrays with their numercial values. * Return true if the sequence was handled; false if we should try * a previous handler (set by addCsiHandler or setCsiHandler). - * The most recently-added handler is tried first. + * The most recently added handler is tried first. * @return An IDisposable you can call to remove this handler. */ addCsiHandler(id: IFunctionIdentifier, callback: (params: (number | number[])[]) => boolean): IDisposable; @@ -1066,7 +1066,7 @@ declare module 'xterm' { * The function gets the payload and numerical parameters as arguments. * Return true if the sequence was handled; false if we should try * a previous handler (set by addDcsHandler or setDcsHandler). - * The most recently-added handler is tried first. + * The most recently added handler is tried first. * @return An IDisposable you can call to remove this handler. */ addDcsHandler(id: IFunctionIdentifier, callback: (data: string, param: (number | number[])[]) => boolean): IDisposable; @@ -1079,7 +1079,7 @@ declare module 'xterm' { * @param callback The function to handle the sequence. * Return true if the sequence was handled; false if we should try * a previous handler (set by addEscHandler or setEscHandler). - * The most recently-added handler is tried first. + * The most recently added handler is tried first. * @return An IDisposable you can call to remove this handler. */ addEscHandler(id: IFunctionIdentifier, handler: () => boolean): IDisposable; @@ -1097,7 +1097,7 @@ declare module 'xterm' { * The callback is called with OSC data string. * Return true if the sequence was handled; false if we should try * a previous handler (set by addOscHandler or setOscHandler). - * The most recently-added handler is tried first. + * The most recently added handler is tried first. * @return An IDisposable you can call to remove this handler. */ addOscHandler(ident: number, callback: (data: string) => boolean): IDisposable;