Remove input handler Terminal.resize dep
This commit is contained in:
+2
-2
@@ -1741,7 +1741,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* through `options.windowsOptions`.
|
||||
*/
|
||||
if (this._optionsService.options.windowOptions.setWinLines) {
|
||||
this._terminal.resize(132, this._bufferService.rows);
|
||||
this._bufferService.resize(132, this._bufferService.rows);
|
||||
this._onRequestReset.fire();
|
||||
}
|
||||
break;
|
||||
@@ -1968,7 +1968,7 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
* through `options.windowsOptions`.
|
||||
*/
|
||||
if (this._optionsService.options.windowOptions.setWinLines) {
|
||||
this._terminal.resize(80, this._bufferService.rows);
|
||||
this._bufferService.resize(80, this._bufferService.rows);
|
||||
this._onRequestReset.fire();
|
||||
}
|
||||
break;
|
||||
|
||||
+6
-15
@@ -47,7 +47,6 @@ import { ColorManager } from 'browser/ColorManager';
|
||||
import { RenderService } from 'browser/services/RenderService';
|
||||
import { ICharSizeService, IRenderService, IMouseService, ISelectionService, ISoundService, ICoreBrowserService } from 'browser/services/Services';
|
||||
import { CharSizeService } from 'browser/services/CharSizeService';
|
||||
import { MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/BufferService';
|
||||
import { IBuffer } from 'common/buffer/Types';
|
||||
import { MouseService } from 'browser/services/MouseService';
|
||||
import { IParams, IFunctionIdentifier } from 'common/parser/Types';
|
||||
@@ -155,6 +154,9 @@ export class Terminal extends CoreTerminal implements ITerminal, IInputHandlingT
|
||||
|
||||
this._setup();
|
||||
|
||||
// Setup listeners
|
||||
this._bufferService.onResize(e => this._afterResize(e.cols, e.rows));
|
||||
|
||||
this._writeBuffer = new WriteBuffer(data => this._inputHandler.parse(data));
|
||||
}
|
||||
|
||||
@@ -1275,10 +1277,6 @@ export class Terminal extends CoreTerminal implements ITerminal, IInputHandlingT
|
||||
* @param y The number of rows to resize to.
|
||||
*/
|
||||
public resize(x: number, y: number): void {
|
||||
if (isNaN(x) || isNaN(y)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (x === this.cols && y === this.rows) {
|
||||
// Check if we still need to measure the char size (fixes #785).
|
||||
if (this._charSizeService && !this._charSizeService.hasValidSize) {
|
||||
@@ -1287,22 +1285,15 @@ export class Terminal extends CoreTerminal implements ITerminal, IInputHandlingT
|
||||
return;
|
||||
}
|
||||
|
||||
x = Math.max(x, MINIMUM_COLS);
|
||||
y = Math.max(y, MINIMUM_ROWS);
|
||||
|
||||
this._bufferService.resize(x, y);
|
||||
|
||||
// TODO: Have charsize, viewport and renderservice depend on IBufferService.onResize?
|
||||
super.resize(x, y);
|
||||
}
|
||||
|
||||
private _afterResize(x: number, y: number): void {
|
||||
this._charSizeService?.measure();
|
||||
|
||||
// TODO: Call on resize event?
|
||||
// Sync the scroll area to make sure scroll events don't fire and scroll the viewport to an
|
||||
// invalid location
|
||||
this.viewport?.syncScrollArea(true);
|
||||
|
||||
// TODO: Move to renderservice
|
||||
this.refresh(0, this.rows - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
-1
@@ -24,7 +24,6 @@ export interface IInputHandlingTerminal {
|
||||
viewport: IViewport;
|
||||
|
||||
is(term: string): boolean;
|
||||
resize(x: number, y: number): void;
|
||||
}
|
||||
|
||||
export interface ICompositionHelper {
|
||||
|
||||
@@ -40,8 +40,7 @@ export class RenderService extends Disposable implements IRenderService {
|
||||
screenElement: HTMLElement,
|
||||
@IOptionsService optionsService: IOptionsService,
|
||||
@ICharSizeService charSizeService: ICharSizeService,
|
||||
@IBufferService private readonly _bufferService: IBufferService,
|
||||
@ICoreService private readonly _coreService: ICoreService
|
||||
@IBufferService private readonly _bufferService: IBufferService
|
||||
) {
|
||||
super();
|
||||
this._renderDebouncer = new RenderDebouncer((start, end) => this._renderRows(start, end));
|
||||
@@ -51,6 +50,7 @@ export class RenderService extends Disposable implements IRenderService {
|
||||
this._screenDprMonitor.setListener(() => this.onDevicePixelRatioChange());
|
||||
this.register(this._screenDprMonitor);
|
||||
|
||||
this.register(this._bufferService.onResize(e => this._fullRefresh()));
|
||||
this.register(optionsService.onOptionChange(() => this._renderer.onOptionsChanged()));
|
||||
this.register(charSizeService.onCharSizeChange(() => this.onCharSizeChanged()));
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import { Disposable } from 'common/Lifecycle';
|
||||
import { IInstantiationService, IOptionsService, IBufferService, ILogService, ICharsetService, ICoreService, ICoreMouseService, IUnicodeService, IDirtyRowService } from 'common/services/Services';
|
||||
import { InstantiationService } from 'common/services/InstantiationService';
|
||||
import { LogService } from 'common/services/LogService';
|
||||
import { BufferService } from 'common/services/BufferService';
|
||||
import { BufferService, MINIMUM_COLS, MINIMUM_ROWS } from 'common/services/BufferService';
|
||||
import { OptionsService } from 'common/services/OptionsService';
|
||||
import { ITerminalOptions, IDisposable } from './Types';
|
||||
import { CoreService } from 'common/services/CoreService';
|
||||
@@ -105,6 +105,17 @@ export abstract class CoreTerminal extends Disposable {
|
||||
this._windowsMode = undefined;
|
||||
}
|
||||
|
||||
public resize(x: number, y: number): void {
|
||||
if (isNaN(x) || isNaN(y)) {
|
||||
return;
|
||||
}
|
||||
|
||||
x = Math.max(x, MINIMUM_COLS);
|
||||
y = Math.max(y, MINIMUM_ROWS);
|
||||
|
||||
this._bufferService.resize(x, y);
|
||||
}
|
||||
|
||||
protected _setup(): void {
|
||||
if (this.optionsService.options.windowsMode) {
|
||||
this._enableWindowsMode();
|
||||
|
||||
@@ -16,6 +16,7 @@ export class MockBufferService implements IBufferService {
|
||||
public serviceBrand: any;
|
||||
public get buffer(): IBuffer { return this.buffers.active; }
|
||||
public buffers: IBufferSet = {} as any;
|
||||
public onResize: IEvent<{ cols: number, rows: number }> = new EventEmitter<{ cols: number, rows: number }>().event;
|
||||
constructor(
|
||||
public cols: number,
|
||||
public rows: number,
|
||||
|
||||
Reference in New Issue
Block a user