mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
@@ -1445,4 +1445,53 @@ describe('InputHandler', () => {
|
||||
assert.deepEqual(getLines(term), ['¥¥ ¥¥', '¥¥ ¥', '¥¥ ¥', '¥¥¥¥¥', '']);
|
||||
});
|
||||
});
|
||||
describe('DECSTR', () => {
|
||||
let term: TestTerminal;
|
||||
beforeEach(() => {
|
||||
term = new TestTerminal({cols: 10, rows: 5, scrollback: 1});
|
||||
term.writeSync('01234567890123');
|
||||
});
|
||||
it('should reset IRM', () => {
|
||||
term.writeSync('\x1b[4h');
|
||||
assert.equal(term.insertMode, true);
|
||||
term.writeSync('\x1b[!p');
|
||||
assert.equal(term.insertMode, false);
|
||||
});
|
||||
it('should reset cursor visibility', () => {
|
||||
term.writeSync('\x1b[?25l');
|
||||
assert.equal((term as any)._coreService.isCursorHidden, true);
|
||||
term.writeSync('\x1b[!p');
|
||||
assert.equal((term as any)._coreService.isCursorHidden, false);
|
||||
});
|
||||
it('should reset scroll margins', () => {
|
||||
term.writeSync('\x1b[2;4r');
|
||||
assert.equal((term as any)._bufferService.buffer.scrollTop, 1);
|
||||
assert.equal((term as any)._bufferService.buffer.scrollBottom, 3);
|
||||
term.writeSync('\x1b[!p');
|
||||
assert.equal((term as any)._bufferService.buffer.scrollTop, 0);
|
||||
assert.equal((term as any)._bufferService.buffer.scrollBottom, term.rows - 1);
|
||||
});
|
||||
it('should reset text attributes', () => {
|
||||
term.writeSync('\x1b[1;2;32;43m');
|
||||
assert.equal(!!term.curAttrData.isBold(), true);
|
||||
term.writeSync('\x1b[!p');
|
||||
assert.equal(!!term.curAttrData.isBold(), false);
|
||||
assert.equal(term.curAttrData.fg, 0);
|
||||
assert.equal(term.curAttrData.bg, 0);
|
||||
});
|
||||
it('should reset DECSC data', () => {
|
||||
term.writeSync('\x1b7');
|
||||
assert.equal((term as any)._bufferService.buffer.savedX, 4);
|
||||
assert.equal((term as any)._bufferService.buffer.savedY, 1);
|
||||
term.writeSync('\x1b[!p');
|
||||
assert.equal((term as any)._bufferService.buffer.savedX, 0);
|
||||
assert.equal((term as any)._bufferService.buffer.savedY, 0);
|
||||
});
|
||||
it('should reset DECOM', () => {
|
||||
term.writeSync('\x1b[?6h');
|
||||
assert.equal((term as any)._coreService.decPrivateModes.origin, true);
|
||||
term.writeSync('\x1b[!p');
|
||||
assert.equal((term as any)._coreService.decPrivateModes.origin, false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+12
-2
@@ -2344,11 +2344,12 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* DECSTR only resets certain attributes. For most needs DECSTR should be sufficient.
|
||||
*
|
||||
* The following terminal attributes are reset to default values:
|
||||
* - cursor is reset (default = visible, home position)
|
||||
* - IRM is reset (dafault = false)
|
||||
* - scroll margins are reset (default = viewport size)
|
||||
* - erase attributes are reset to default
|
||||
* - charsets are reset
|
||||
* - DECSC data is reset to initial values
|
||||
* - DECOM is reset to absolute mode
|
||||
*
|
||||
*
|
||||
* FIXME: there are several more attributes missing (see VT520 manual)
|
||||
@@ -2360,9 +2361,18 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
this._bufferService.buffer.scrollTop = 0;
|
||||
this._bufferService.buffer.scrollBottom = this._bufferService.rows - 1;
|
||||
this._curAttrData = DEFAULT_ATTR_DATA.clone();
|
||||
this._bufferService.buffer.x = this._bufferService.buffer.y = 0; // ?
|
||||
this._coreService.reset();
|
||||
this._charsetService.reset();
|
||||
|
||||
// reset DECSC data
|
||||
this._bufferService.buffer.savedX = 0;
|
||||
this._bufferService.buffer.savedY = this._bufferService.buffer.ybase;
|
||||
this._bufferService.buffer.savedCurAttrData.fg = this._curAttrData.fg;
|
||||
this._bufferService.buffer.savedCurAttrData.bg = this._curAttrData.bg;
|
||||
this._bufferService.buffer.savedCharset = this._charsetService.charset;
|
||||
|
||||
// reset DECOM
|
||||
this._coreService.decPrivateModes.origin = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user