Comparing version 3.15.0-beta24 to 3.15.0-beta25
{ | ||
"name": "xterm", | ||
"description": "Full xterm terminal, in your browser", | ||
"version": "3.15.0-beta24", | ||
"version": "3.15.0-beta25", | ||
"main": "lib/xterm.js", | ||
@@ -6,0 +6,0 @@ "types": "typings/xterm.d.ts", |
@@ -234,2 +234,3 @@ /** | ||
public currentState: number; | ||
public precedingCodepoint: number; | ||
@@ -268,2 +269,3 @@ // buffers over several parse calls | ||
this._collect = ''; | ||
this.precedingCodepoint = 0; | ||
@@ -399,2 +401,3 @@ // set default fallback handlers and handler lookup containers | ||
this._activeDcsHandler = null; | ||
this.precedingCodepoint = 0; | ||
} | ||
@@ -459,2 +462,3 @@ | ||
case ParserAction.EXECUTE: | ||
this.precedingCodepoint = 0; | ||
callback = this._executeHandlers[code]; | ||
@@ -481,2 +485,6 @@ if (callback) callback(); | ||
case ParserAction.CSI_DISPATCH: | ||
// dont reset preceding codepoint for REP itself | ||
if (code !== 98) { // 'b' | ||
this.precedingCodepoint = 0; | ||
} | ||
// Trigger CSI Handler | ||
@@ -507,2 +515,3 @@ const handlers = this._csiHandlers[code]; | ||
case ParserAction.ESC_DISPATCH: | ||
this.precedingCodepoint = 0; | ||
callback = this._escHandlers[collect + String.fromCharCode(code)]; | ||
@@ -518,2 +527,3 @@ if (callback) callback(collect, code); | ||
case ParserAction.DCS_HOOK: | ||
this.precedingCodepoint = 0; | ||
dcsHandler = this._dcsHandlers[collect + String.fromCharCode(code)]; | ||
@@ -560,2 +570,3 @@ if (!dcsHandler) dcsHandler = this._dcsHandlerFb; | ||
case ParserAction.OSC_END: | ||
this.precedingCodepoint = 0; | ||
if (osc && code !== 0x18 && code !== 0x1a) { | ||
@@ -562,0 +573,0 @@ // NOTE: OSC subparsing is not part of the original parser |
@@ -106,2 +106,8 @@ /** | ||
/** | ||
* Preceding codepoint to get REP working correctly. | ||
* This must be set by the print handler as last action. | ||
* It gets reset by the parser for any valid sequence beside REP itself. | ||
*/ | ||
precedingCodepoint: number; | ||
/** | ||
* Reset the parser to its initial state (handlers are kept). | ||
@@ -108,0 +114,0 @@ */ |
@@ -244,2 +244,52 @@ /** | ||
}); | ||
it('REP: Repeat preceding character, ECMA48 - CSI Ps b', async function(): Promise<any> { | ||
// default to 1 | ||
await page.evaluate(` | ||
window.term.resize(10, 10); | ||
window.term.write('#\x1b[b'); | ||
window.term.writeln(''); | ||
window.term.write('#\x1b[0b'); | ||
window.term.writeln(''); | ||
window.term.write('#\x1b[1b'); | ||
window.term.writeln(''); | ||
window.term.write('#\x1b[5b'); | ||
`); | ||
assert.deepEqual(await getLinesAsArray(4), ['##', '##', '##', '######']); | ||
assert.deepEqual(await getCursor(), {col: 6, row: 3}); | ||
// should not repeat on fullwidth chars | ||
await page.evaluate(` | ||
window.term.reset(); | ||
window.term.write('¥\x1b[10b'); | ||
`); | ||
assert.deepEqual(await getLinesAsArray(1), ['¥']); | ||
// should repeat only base char of combining | ||
await page.evaluate(` | ||
window.term.reset(); | ||
window.term.write('e\u0301\x1b[5b'); | ||
`); | ||
assert.deepEqual(await getLinesAsArray(1), ['e\u0301eeeee']); | ||
// should wrap correctly | ||
await page.evaluate(` | ||
window.term.reset(); | ||
window.term.write('#\x1b[15b'); | ||
`); | ||
assert.deepEqual(await getLinesAsArray(2), ['##########', '######']); | ||
await page.evaluate(` | ||
window.term.reset(); | ||
window.term.write('\x1b[?7l'); // disable wrap around | ||
window.term.write('#\x1b[15b'); | ||
`); | ||
assert.deepEqual(await getLinesAsArray(2), ['##########', '']); | ||
// any successful sequence should reset REP | ||
await page.evaluate(` | ||
window.term.reset(); | ||
window.term.write('\x1b[?7h'); // re-enable wrap around | ||
window.term.write('#\\n\x1b[3b'); | ||
window.term.write('#\\r\x1b[3b'); | ||
window.term.writeln(''); | ||
window.term.write('abcdefg\x1b[3D\x1b[10b#\x1b[3b'); | ||
`); | ||
assert.deepEqual(await getLinesAsArray(3), ['#', ' #', 'abcd####']); | ||
}); | ||
}); | ||
@@ -278,1 +328,9 @@ }); | ||
} | ||
async function getCursor(): Promise<{col: number, row: number}> { | ||
return page.evaluate(` | ||
(function() { | ||
return {col: term.buffer.cursorX, row: term.buffer.cursorY}; | ||
})(); | ||
`); | ||
} |
@@ -110,3 +110,3 @@ /** | ||
const skip = [ | ||
10, 16, 17, 19, 32, 33, 34, 35, 36, 39, | ||
10, 16, 17, 19, 32, 34, 35, 36, 39, | ||
40, 42, 43, 44, 45, 46, 47, 48, 49, 50, | ||
@@ -113,0 +113,0 @@ 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
1658009
17218