Move sendFocus to core service

This commit is contained in:
Daniel Imms
2020-04-25 13:26:06 -07:00
parent d5729f9216
commit 37996bcd15
7 changed files with 7 additions and 8 deletions
+2 -2
View File
@@ -1771,7 +1771,7 @@ export class InputHandler extends Disposable implements IInputHandler {
case 1004: // send focusin/focusout events
// focusin: ^[[I
// focusout: ^[[O
this._terminal.sendFocus = true;
this._coreService.decPrivateModes.sendFocus = true;
break;
case 1005: // utf8 ext mode mouse - removed in #2507
this._logService.debug('DECSET 1005 not supported (see #2507)');
@@ -1986,7 +1986,7 @@ export class InputHandler extends Disposable implements IInputHandler {
this._coreMouseService.activeProtocol = 'NONE';
break;
case 1004: // send focusin/focusout events
this._terminal.sendFocus = false;
this._coreService.decPrivateModes.sendFocus = false;
break;
case 1005: // utf8 ext mode mouse - removed in #2507
this._logService.debug('DECRST 1005 not supported (see #2507)');
+2 -3
View File
@@ -90,7 +90,6 @@ export class Terminal extends CoreTerminal implements ITerminal, IInputHandlingT
// mouse properties
public mouseEvents: CoreMouseEventType = CoreMouseEventType.NONE;
public sendFocus: boolean;
// write buffer
private _writeBuffer: WriteBuffer;
@@ -277,7 +276,7 @@ export class Terminal extends CoreTerminal implements ITerminal, IInputHandlingT
* Binds the desired focus behavior on a given terminal object.
*/
private _onTextAreaFocus(ev: KeyboardEvent): void {
if (this.sendFocus) {
if (this._coreService.decPrivateModes.sendFocus) {
this._coreService.triggerDataEvent(C0.ESC + '[I');
}
this.updateCursorStyle(ev);
@@ -302,7 +301,7 @@ export class Terminal extends CoreTerminal implements ITerminal, IInputHandlingT
// screen readers reading it out.
this.textarea.value = '';
this.refresh(this.buffer.y, this.buffer.y);
if (this.sendFocus) {
if (this._coreService.decPrivateModes.sendFocus) {
this._coreService.triggerDataEvent(C0.ESC + '[O');
}
this.element.classList.remove('focus');
-1
View File
@@ -203,7 +203,6 @@ export class MockTerminal implements ITerminal {
export class MockInputHandlingTerminal implements IInputHandlingTerminal {
public onA11yCharEmitter: EventEmitter<string>;
public onA11yTabEmitter: EventEmitter<number>;
public sendFocus: boolean;
public buffers: IBufferSet;
public buffer: IBuffer = new MockBuffer();
public viewport: IViewport;
-2
View File
@@ -21,8 +21,6 @@ export type LineData = CharData[];
* InputHandler cleanly from the ITerminal interface.
*/
export interface IInputHandlingTerminal {
sendFocus: boolean;
buffers: IBufferSet;
buffer: IBuffer;
viewport: IViewport;
+1
View File
@@ -66,6 +66,7 @@ export class MockCoreService implements ICoreService {
applicationKeypad: false,
bracketedPasteMode: false,
origin: false,
sendFocus: false,
wraparound: true
};
public onData: IEvent<string> = new EventEmitter<string>().event;
+1
View File
@@ -168,6 +168,7 @@ export interface IDecPrivateModes {
applicationKeypad: boolean;
bracketedPasteMode: boolean;
origin: boolean;
sendFocus: boolean;
wraparound: boolean; // defaults: xterm - true, vt100 - false
}
+1
View File
@@ -17,6 +17,7 @@ const DEFAULT_DEC_PRIVATE_MODES: IDecPrivateModes = Object.freeze({
applicationKeypad: false,
bracketedPasteMode: false,
origin: false,
sendFocus: false,
wraparound: true // defaults: xterm - true, vt100 - false
});