Remove terminal dep from SelectionModel
This commit is contained in:
@@ -126,7 +126,7 @@ export class SelectionManager implements ISelectionManager {
|
|||||||
this._initListeners();
|
this._initListeners();
|
||||||
this.enable();
|
this.enable();
|
||||||
|
|
||||||
this._model = new SelectionModel(_terminal, bufferService);
|
this._model = new SelectionModel(bufferService);
|
||||||
this._activeSelectionMode = SelectionMode.NORMAL;
|
this._activeSelectionMode = SelectionMode.NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,36 +4,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { ITerminal } from './Types';
|
|
||||||
import { SelectionModel } from './SelectionModel';
|
import { SelectionModel } from './SelectionModel';
|
||||||
import { BufferSet } from 'common/buffer/BufferSet';
|
import { MockBufferService } from 'common/TestUtils.test';
|
||||||
import { MockTerminal } from './TestUtils.test';
|
|
||||||
import { MockOptionsService, MockBufferService } from 'common/TestUtils.test';
|
|
||||||
import { IBufferService } from 'common/services/Services';
|
|
||||||
|
|
||||||
class TestSelectionModel extends SelectionModel {
|
|
||||||
constructor(
|
|
||||||
terminal: ITerminal,
|
|
||||||
bufferService: IBufferService
|
|
||||||
) {
|
|
||||||
super(terminal, bufferService);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('SelectionManager', () => {
|
describe('SelectionManager', () => {
|
||||||
let terminal: ITerminal;
|
let model: SelectionModel;
|
||||||
let model: TestSelectionModel;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
terminal = new MockTerminal();
|
|
||||||
const bufferService = new MockBufferService(80, 2);
|
const bufferService = new MockBufferService(80, 2);
|
||||||
terminal.buffers = new BufferSet(
|
model = new SelectionModel(bufferService);
|
||||||
new MockOptionsService({ scrollback: 10 }),
|
|
||||||
bufferService
|
|
||||||
);
|
|
||||||
terminal.buffer = terminal.buffers.active;
|
|
||||||
|
|
||||||
model = new TestSelectionModel(terminal, bufferService);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('clearSelection', () => {
|
describe('clearSelection', () => {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ITerminal } from './Types';
|
|
||||||
import { IBufferService } from 'common/services/Services';
|
import { IBufferService } from 'common/services/Services';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,7 +33,6 @@ export class SelectionModel {
|
|||||||
public selectionEnd: [number, number];
|
public selectionEnd: [number, number];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _terminal: ITerminal,
|
|
||||||
private _bufferService: IBufferService
|
private _bufferService: IBufferService
|
||||||
) {
|
) {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
@@ -71,7 +69,7 @@ export class SelectionModel {
|
|||||||
*/
|
*/
|
||||||
public get finalSelectionEnd(): [number, number] {
|
public get finalSelectionEnd(): [number, number] {
|
||||||
if (this.isSelectAllActive) {
|
if (this.isSelectAllActive) {
|
||||||
return [this._bufferService.cols, this._terminal.buffer.ybase + this._bufferService.rows - 1];
|
return [this._bufferService.cols, this._bufferService.buffer.ybase + this._bufferService.rows - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.selectionStart) {
|
if (!this.selectionStart) {
|
||||||
|
|||||||
Reference in New Issue
Block a user