mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Remove terminal dep from SelectionModel
This commit is contained in:
@@ -126,7 +126,7 @@ export class SelectionManager implements ISelectionManager {
|
||||
this._initListeners();
|
||||
this.enable();
|
||||
|
||||
this._model = new SelectionModel(_terminal, bufferService);
|
||||
this._model = new SelectionModel(bufferService);
|
||||
this._activeSelectionMode = SelectionMode.NORMAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,36 +4,15 @@
|
||||
*/
|
||||
|
||||
import { assert } from 'chai';
|
||||
import { ITerminal } from './Types';
|
||||
import { SelectionModel } from './SelectionModel';
|
||||
import { BufferSet } from 'common/buffer/BufferSet';
|
||||
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);
|
||||
}
|
||||
}
|
||||
import { MockBufferService } from 'common/TestUtils.test';
|
||||
|
||||
describe('SelectionManager', () => {
|
||||
let terminal: ITerminal;
|
||||
let model: TestSelectionModel;
|
||||
let model: SelectionModel;
|
||||
|
||||
beforeEach(() => {
|
||||
terminal = new MockTerminal();
|
||||
const bufferService = new MockBufferService(80, 2);
|
||||
terminal.buffers = new BufferSet(
|
||||
new MockOptionsService({ scrollback: 10 }),
|
||||
bufferService
|
||||
);
|
||||
terminal.buffer = terminal.buffers.active;
|
||||
|
||||
model = new TestSelectionModel(terminal, bufferService);
|
||||
model = new SelectionModel(bufferService);
|
||||
});
|
||||
|
||||
describe('clearSelection', () => {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { ITerminal } from './Types';
|
||||
import { IBufferService } from 'common/services/Services';
|
||||
|
||||
/**
|
||||
@@ -34,7 +33,6 @@ export class SelectionModel {
|
||||
public selectionEnd: [number, number];
|
||||
|
||||
constructor(
|
||||
private _terminal: ITerminal,
|
||||
private _bufferService: IBufferService
|
||||
) {
|
||||
this.clearSelection();
|
||||
@@ -71,7 +69,7 @@ export class SelectionModel {
|
||||
*/
|
||||
public get finalSelectionEnd(): [number, number] {
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user