Remove Terminal.showCursor dep from input handler

This commit is contained in:
Daniel Imms
2020-04-25 16:18:43 -07:00
parent c5ba1d62e7
commit 9346eba2f2
6 changed files with 10 additions and 20 deletions
+2 -2
View File
@@ -1794,9 +1794,9 @@ export class InputHandler extends Disposable implements IInputHandler {
case 47: // alt screen buffer case 47: // alt screen buffer
case 1047: // alt screen buffer case 1047: // alt screen buffer
this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()); this._bufferService.buffers.activateAltBuffer(this._eraseAttrData());
this._coreService.isCursorInitialized = true;
this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1); this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1);
this._terminal.viewport?.syncScrollArea(); this._terminal.viewport?.syncScrollArea();
this._terminal.showCursor();
break; break;
case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste) case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)
this._coreService.decPrivateModes.bracketedPasteMode = true; this._coreService.decPrivateModes.bracketedPasteMode = true;
@@ -2012,9 +2012,9 @@ export class InputHandler extends Disposable implements IInputHandler {
if (params.params[i] === 1049) { if (params.params[i] === 1049) {
this.restoreCursor(); this.restoreCursor();
} }
this._coreService.isCursorInitialized = true;
this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1); this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1);
this._terminal.viewport?.syncScrollArea(); this._terminal.viewport?.syncScrollArea();
this._terminal.showCursor();
break; break;
case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste) case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)
this._coreService.decPrivateModes.bracketedPasteMode = false; this._coreService.decPrivateModes.bracketedPasteMode = false;
-2
View File
@@ -140,7 +140,6 @@ describe('Terminal', () => {
}; };
beforeEach(() => { beforeEach(() => {
term.showCursor = () => { };
term.clearSelection = () => { }; term.clearSelection = () => { };
}); });
@@ -531,7 +530,6 @@ describe('Terminal', () => {
let evKeyPress: any; let evKeyPress: any;
beforeEach(() => { beforeEach(() => {
term.showCursor = () => { };
term.clearSelection = () => { }; term.clearSelection = () => { };
// term.compositionHelper = { // term.compositionHelper = {
// isComposing: false, // isComposing: false,
+4 -4
View File
@@ -278,7 +278,7 @@ export class Terminal extends CoreTerminal implements ITerminal, IInputHandlingT
} }
this.updateCursorStyle(ev); this.updateCursorStyle(ev);
this.element.classList.add('focus'); this.element.classList.add('focus');
this.showCursor(); this._showCursor();
this._onFocus.fire(); this._onFocus.fire();
} }
@@ -830,7 +830,7 @@ export class Terminal extends CoreTerminal implements ITerminal, IInputHandlingT
/** /**
* Display the cursor element * Display the cursor element
*/ */
public showCursor(): void { private _showCursor(): void {
if (!this._coreService.isCursorInitialized) { if (!this._coreService.isCursorInitialized) {
this._coreService.isCursorInitialized = true; this._coreService.isCursorInitialized = true;
this.refresh(this.buffer.y, this.buffer.y); this.refresh(this.buffer.y, this.buffer.y);
@@ -1165,7 +1165,7 @@ export class Terminal extends CoreTerminal implements ITerminal, IInputHandlingT
} }
this._onKey.fire({ key: result.key, domEvent: event }); this._onKey.fire({ key: result.key, domEvent: event });
this.showCursor(); this._showCursor();
this._coreService.triggerDataEvent(result.key, true); this._coreService.triggerDataEvent(result.key, true);
// Cancel events when not in screen reader mode so events don't get bubbled up and handled by // Cancel events when not in screen reader mode so events don't get bubbled up and handled by
@@ -1242,7 +1242,7 @@ export class Terminal extends CoreTerminal implements ITerminal, IInputHandlingT
key = String.fromCharCode(key); key = String.fromCharCode(key);
this._onKey.fire({ key, domEvent: ev }); this._onKey.fire({ key, domEvent: ev });
this.showCursor(); this._showCursor();
this._coreService.triggerDataEvent(key, true); this._coreService.triggerDataEvent(key, true);
return true; return true;
-6
View File
@@ -190,9 +190,6 @@ export class MockTerminal implements ITerminal {
public reset(): void { public reset(): void {
throw new Error('Method not implemented.'); throw new Error('Method not implemented.');
} }
public showCursor(): void {
throw new Error('Method not implemented.');
}
public refresh(start: number, end: number): void { public refresh(start: number, end: number): void {
throw new Error('Method not implemented.'); throw new Error('Method not implemented.');
} }
@@ -215,9 +212,6 @@ export class MockInputHandlingTerminal implements IInputHandlingTerminal {
public resize(x: number, y: number): void { public resize(x: number, y: number): void {
throw new Error('Method not implemented.'); throw new Error('Method not implemented.');
} }
public showCursor(): void {
throw new Error('Method not implemented.');
}
public handler(data: string): void { public handler(data: string): void {
throw new Error('Method not implemented.'); throw new Error('Method not implemented.');
} }
-4
View File
@@ -21,8 +21,6 @@ export type LineData = CharData[];
* InputHandler cleanly from the ITerminal interface. * InputHandler cleanly from the ITerminal interface.
*/ */
export interface IInputHandlingTerminal { export interface IInputHandlingTerminal {
buffers: IBufferSet;
buffer: IBuffer;
viewport: IViewport; viewport: IViewport;
onA11yCharEmitter: IEventEmitter<string>; onA11yCharEmitter: IEventEmitter<string>;
@@ -31,7 +29,6 @@ export interface IInputHandlingTerminal {
scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void; scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;
is(term: string): boolean; is(term: string): boolean;
resize(x: number, y: number): void; resize(x: number, y: number): void;
showCursor(): void;
handleTitle(title: string): void; handleTitle(title: string): void;
} }
@@ -143,7 +140,6 @@ export interface ITerminal extends IPublicTerminal, IElementAccessor, IBufferAcc
scrollLines(disp: number, suppressScrollEvent?: boolean): void; scrollLines(disp: number, suppressScrollEvent?: boolean): void;
cancel(ev: Event, force?: boolean): boolean | void; cancel(ev: Event, force?: boolean): boolean | void;
showCursor(): void;
} }
// Portions of the public API that are required by the internal Terminal // Portions of the public API that are required by the internal Terminal
+4 -2
View File
@@ -10,7 +10,7 @@ import { Disposable } from 'common/Lifecycle';
import { ScreenDprMonitor } from 'browser/ScreenDprMonitor'; import { ScreenDprMonitor } from 'browser/ScreenDprMonitor';
import { addDisposableDomListener } from 'browser/Lifecycle'; import { addDisposableDomListener } from 'browser/Lifecycle';
import { IColorSet } from 'browser/Types'; import { IColorSet } from 'browser/Types';
import { IOptionsService } from 'common/services/Services'; import { IOptionsService, IBufferService, ICoreService } from 'common/services/Services';
import { ICharSizeService, IRenderService } from 'browser/services/Services'; import { ICharSizeService, IRenderService } from 'browser/services/Services';
export class RenderService extends Disposable implements IRenderService { export class RenderService extends Disposable implements IRenderService {
@@ -39,7 +39,9 @@ export class RenderService extends Disposable implements IRenderService {
private _rowCount: number, private _rowCount: number,
screenElement: HTMLElement, screenElement: HTMLElement,
@IOptionsService optionsService: IOptionsService, @IOptionsService optionsService: IOptionsService,
@ICharSizeService charSizeService: ICharSizeService @ICharSizeService charSizeService: ICharSizeService,
@IBufferService private readonly _bufferService: IBufferService,
@ICoreService private readonly _coreService: ICoreService
) { ) {
super(); super();
this._renderDebouncer = new RenderDebouncer((start, end) => this._renderRows(start, end)); this._renderDebouncer = new RenderDebouncer((start, end) => this._renderRows(start, end));