Convert internal key event usages

This commit is contained in:
Daniel Imms
2019-04-04 00:45:57 -04:00
parent 629238ae70
commit 2f8d49c74d
2 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -79,7 +79,7 @@ export class AccessibilityManager extends Disposable {
this.register(this._terminal.addDisposableListener('a11y.char', (char) => this._onChar(char)));
this.register(this._terminal.addDisposableListener('linefeed', () => this._onChar('\n')));
this.register(this._terminal.addDisposableListener('a11y.tab', spaceCount => this._onTab(spaceCount)));
this.register(this._terminal.addDisposableListener('key', keyChar => this._onKey(keyChar)));
this.register(this._terminal.onKey(e => this._onKey(e.key)));
this.register(this._terminal.addDisposableListener('blur', () => this._clearLiveRegion()));
// TODO: Maybe renderer should fire an event on terminal when the characters change and that
// should be listened to instead? That would mean that the order of events are always
+6 -3
View File
@@ -266,9 +266,12 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
this.on('data', e => this._onInput.fire(e));
this.on('title', e => this._onTitleChange.fire(e));
this.on('scroll', e => this._onScroll.fire(e));
this.on('key', e => this._onKey.fire(e));
this.on('refresh', e => this._onRender.fire(e));
this.on('resize', e => this._onResize.fire(e));
// TODO: Remove these in v4
// Fire old style events from new emitters
this.onKey(e => this.emit('key', e.key, e.domEvent));
}
public dispose(): void {
@@ -1615,7 +1618,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
}
this.emit('keydown', event);
this.emit('key', result.key, event);
this._onKey.fire({ key: result.key, domEvent: event });
this.showCursor();
this.handler(result.key);
@@ -1694,7 +1697,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
key = String.fromCharCode(key);
this.emit('keypress', key, ev);
this.emit('key', key, ev);
this._onKey.fire({ key, domEvent: ev });
this.showCursor();
this.handler(key);