several fixes

This commit is contained in:
Jörg Breitbart
2019-12-07 13:23:00 +01:00
parent 5b95f7e565
commit b5fdd3b8d8
6 changed files with 69 additions and 81 deletions
-22
View File
@@ -1304,28 +1304,6 @@ describe('InputHandler', () => {
term.writeSync('\x1b[18t');
assert.deepEqual(stack, ['\x1b[8;10;10t', '\x1b[8;20;50t']);
});
it('20 - GetIconTitle', () => {
const term = new TestTerminal({cols: 10, rows: 10, windowOptions: {getIconTitle: true}});
const stack: string[] = [];
term.onData(data => stack.push(data));
term.writeSync('\x1b]1;hello world!\x07');
term.writeSync('\x1b[20t');
assert.deepEqual(stack, ['\x1b]Lhello world!\x1b\\']);
term.writeSync('\x1b]1;some other\x07');
term.writeSync('\x1b[20t');
assert.deepEqual(stack, ['\x1b]Lhello world!\x1b\\', '\x1b]Lsome other\x1b\\']);
});
it('21 - GetWinTitle', () => {
const term = new TestTerminal({cols: 10, rows: 10, windowOptions: {getWinTitle: true}});
const stack: string[] = [];
term.onData(data => stack.push(data));
term.writeSync('\x1b]2;hello world!\x07');
term.writeSync('\x1b[21t');
assert.deepEqual(stack, ['\x1b]lhello world!\x1b\\']);
term.writeSync('\x1b]2;some other\x07');
term.writeSync('\x1b[21t');
assert.deepEqual(stack, ['\x1b]lhello world!\x1b\\', '\x1b]lsome other\x1b\\']);
});
it('22/23 - PushTitle/PopTitle', () => {
const term = new TestTerminal({cols: 10, rows: 10, windowOptions: {pushTitle: true, popTitle: true}});
const stack: string[] = [];
+4 -10
View File
@@ -2146,20 +2146,14 @@ export class InputHandler extends Disposable implements IInputHandler {
this._coreService.triggerDataEvent(`${C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);
}
break;
case 20: // GetIconTitle, returns OSC L label ST
this._coreService.triggerDataEvent(`${C0.ESC}]L${this._iconName}${C0.ESC}\\`);
break;
case 21: // GetWinTitle, returns OSC l label ST
this._coreService.triggerDataEvent(`${C0.ESC}]l${this._windowTitle}${C0.ESC}\\`);
break;
case 22: // PushTitle
if (!second || second === 2) {
if (second === 0 || second === 2) {
this._windowTitleStack.push(this._windowTitle);
if (this._windowTitleStack.length > STACK_LIMIT) {
this._windowTitleStack.shift();
}
}
if (!second || second === 1) {
if (second === 0 || second === 1) {
this._iconNameStack.push(this._iconName);
if (this._iconNameStack.length > STACK_LIMIT) {
this._iconNameStack.shift();
@@ -2167,12 +2161,12 @@ export class InputHandler extends Disposable implements IInputHandler {
}
break;
case 23: // PopTitle
if (!second || second === 2) {
if (second === 0 || second === 2) {
if (this._windowTitleStack.length) {
this.setTitle(this._windowTitleStack.pop());
}
}
if (!second || second === 1) {
if (second === 0 || second === 1) {
if (this._iconNameStack.length) {
this.setIconName(this._iconNameStack.pop());
}
+1 -10
View File
@@ -127,13 +127,9 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
public mouseEvents: CoreMouseEventType = CoreMouseEventType.NONE;
public sendFocus: boolean;
// misc
public curAttrData: IAttributeData;
private _eraseAttrData: IAttributeData;
public params: (string | number)[];
public currentParam: string | number;
// write buffer
private _writeBuffer: WriteBuffer;
@@ -268,9 +264,6 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
this.curAttrData = DEFAULT_ATTR_DATA.clone();
this._eraseAttrData = DEFAULT_ATTR_DATA.clone();
this.params = [];
this.currentParam = 0;
this._userScrolling = false;
// Register input handler and refire/handle events
@@ -1430,9 +1423,7 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
// Sync the scroll area to make sure scroll events don't fire and scroll the viewport to an
// invalid location
if (this.viewport) {
this.viewport.syncScrollArea(true);
}
this.viewport?.syncScrollArea(true);
this.refresh(0, this.rows - 1);
this._onResize.fire({ cols: x, rows: y });
+1 -1
View File
@@ -256,7 +256,7 @@ export interface ICoreMouseProtocol {
export type CoreMouseEncoding = (event: ICoreMouseEvent) => string;
/**
* WindowOption settings.
* windowOptions
*/
export interface IWindowOptions {
restoreWin?: boolean;