@@ -7,7 +7,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IAttributeData, IBufferLine } from 'common/Types';
|
||||
import { BufferSet } from 'common/buffer/BufferSet';
|
||||
import { IBuffer, IBufferSet } from 'common/buffer/Types';
|
||||
import { IBufferService, IOptionsService } from 'common/services/Services';
|
||||
import { IBufferService, IOptionsService, type IBufferResizeEvent } from 'common/services/Services';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
|
||||
export const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars
|
||||
@@ -22,7 +22,7 @@ export class BufferService extends Disposable implements IBufferService {
|
||||
/** Whether the user is scrolling (locks the scroll position) */
|
||||
public isUserScrolling: boolean = false;
|
||||
|
||||
private readonly _onResize = this._register(new Emitter<{ cols: number, rows: number }>());
|
||||
private readonly _onResize = this._register(new Emitter<IBufferResizeEvent>());
|
||||
public readonly onResize = this._onResize.event;
|
||||
private readonly _onScroll = this._register(new Emitter<number>());
|
||||
public readonly onScroll = this._onScroll.event;
|
||||
@@ -43,12 +43,12 @@ export class BufferService extends Disposable implements IBufferService {
|
||||
}
|
||||
|
||||
public resize(cols: number, rows: number): void {
|
||||
const colsChanged = this.cols !== cols;
|
||||
const rowsChanged = this.rows !== rows;
|
||||
this.cols = cols;
|
||||
this.rows = rows;
|
||||
this.buffers.resize(cols, rows);
|
||||
// TODO: This doesn't fire when scrollback changes - add a resize event to BufferSet and forward
|
||||
// event
|
||||
this._onResize.fire({ cols, rows });
|
||||
this._onResize.fire({ cols, rows, colsChanged, rowsChanged });
|
||||
}
|
||||
|
||||
public reset(): void {
|
||||
|
||||
@@ -18,7 +18,7 @@ export interface IBufferService {
|
||||
readonly buffer: IBuffer;
|
||||
readonly buffers: IBufferSet;
|
||||
isUserScrolling: boolean;
|
||||
onResize: Event<{ cols: number, rows: number }>;
|
||||
onResize: Event<IBufferResizeEvent>;
|
||||
onScroll: Event<number>;
|
||||
scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;
|
||||
scrollLines(disp: number, suppressScrollEvent?: boolean): void;
|
||||
@@ -26,6 +26,13 @@ export interface IBufferService {
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
export interface IBufferResizeEvent {
|
||||
cols: number;
|
||||
rows: number;
|
||||
colsChanged: boolean;
|
||||
rowsChanged: boolean;
|
||||
}
|
||||
|
||||
export const ICoreMouseService = createDecorator<ICoreMouseService>('CoreMouseService');
|
||||
export interface ICoreMouseService {
|
||||
serviceBrand: undefined;
|
||||
|
||||
Reference in New Issue
Block a user