Add used members from SelectionService to interface

This commit is contained in:
Daniel Imms
2019-06-29 14:34:48 -07:00
parent 7ee2219314
commit 48f68a7702
3 changed files with 27 additions and 11 deletions
+4
View File
@@ -145,6 +145,10 @@ export class SelectionService implements ISelectionService {
this.initBuffersListeners();
}
public reset(): void {
this.clearSelection();
}
public initBuffersListeners(): void {
this._trimListener = this._bufferService.buffer.lines.onTrim(amount => this._onTrim(amount));
this._bufferService.buffers.onBufferActivate(e => this._onBufferActivate(e));
+6 -8
View File
@@ -49,7 +49,7 @@ import { ColorManager } from 'browser/ColorManager';
import { RenderService } from 'browser/services/RenderService';
import { IOptionsService, IBufferService, ICoreService } from 'common/services/Services';
import { OptionsService } from 'common/services/OptionsService';
import { ICharSizeService, IRenderService, IMouseService } from 'browser/services/Services';
import { ICharSizeService, IRenderService, IMouseService, ISelectionService } from 'browser/services/Services';
import { CharSizeService } from 'browser/services/CharSizeService';
import { BufferService, MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/BufferService';
import { Disposable } from 'common/Lifecycle';
@@ -113,8 +113,9 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
// browser services
private _charSizeService: ICharSizeService;
private _renderService: IRenderService;
private _mouseService: IMouseService;
private _renderService: IRenderService;
public selectionService: ISelectionService;
// modes
public applicationKeypad: boolean;
@@ -174,7 +175,6 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
private _inputHandler: InputHandler;
public soundManager: SoundManager;
public selectionService: SelectionService;
public linkifier: ILinkifier;
public viewport: IViewport;
private _compositionHelper: ICompositionHelper;
@@ -306,11 +306,6 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
this._mouseZoneManager = this._mouseZoneManager || null;
this.soundManager = this.soundManager || new SoundManager(this);
if (this.selectionService) {
this.selectionService.clearSelection();
this.selectionService.initBuffersListeners();
}
if (this.options.windowsMode) {
this._windowsMode = applyWindowsMode(this);
}
@@ -1888,6 +1883,9 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
this._setup();
this._bufferService.reset();
this._coreService.reset();
if (this.selectionService) {
this.selectionService.reset();
}
// reattach
this._customKeyEventHandler = customKeyEventHandler;
+17 -3
View File
@@ -6,6 +6,7 @@
import { IEvent } from 'common/EventEmitter';
import { IRenderDimensions, IRenderer, CharacterJoinerHandler } from 'browser/renderer/Types';
import { IColorSet } from 'browser/Types';
import { ISelectionRedrawRequestEvent } from 'browser/selection/Types';
export interface ICharSizeService {
readonly width: number;
@@ -48,13 +49,26 @@ export interface IRenderService {
}
export interface ISelectionService {
selectionText: string;
selectionStart: [number, number];
selectionEnd: [number, number];
readonly selectionText: string;
readonly hasSelection: boolean;
readonly selectionStart: [number, number];
readonly selectionEnd: [number, number];
readonly onLinuxMouseSelection: IEvent<string>;
readonly onRedrawRequest: IEvent<ISelectionRedrawRequestEvent>
readonly onSelectionChange: IEvent<void>;
disable(): void;
enable(): void;
reset(): void;
setSelection(row: number, col: number, length: number): void;
selectAll(): void;
selectLines(start: number, end: number): void;
clearSelection(): void;
isClickInSelection(event: MouseEvent): boolean;
selectWordAtCursor(event: MouseEvent): void;
shouldColumnSelect(event: KeyboardEvent | MouseEvent): boolean;
shouldForceSelection(event: MouseEvent): boolean;
refresh(isLinuxMouseSelection?: boolean): void;
onMouseDown(event: MouseEvent): void;
}