mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
@@ -152,6 +152,14 @@ export class SelectionService extends Disposable implements ISelectionService {
|
||||
this._register(toDisposable(() => {
|
||||
this._removeMouseDownListeners();
|
||||
}));
|
||||
|
||||
// Clear selection when resizing vertically. This experience could be improved, this is the
|
||||
// simple option to fix the buggy behavior. https://github.com/xtermjs/xterm.js/issues/5300
|
||||
this._register(this._bufferService.onResize(e => {
|
||||
if (e.rowsChanged) {
|
||||
this.clearSelection();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public reset(): void {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { IBufferService, ICoreService, ILogService, IOptionsService, ITerminalOptions, ICoreMouseService, ICharsetService, UnicodeCharProperties, UnicodeCharWidth, IUnicodeService, IUnicodeVersionProvider, LogLevelEnum, IDecorationService, IInternalDecoration, IOscLinkService } from 'common/services/Services';
|
||||
import { IBufferService, ICoreService, ILogService, IOptionsService, ITerminalOptions, ICoreMouseService, ICharsetService, UnicodeCharProperties, UnicodeCharWidth, IUnicodeService, IUnicodeVersionProvider, LogLevelEnum, IDecorationService, IInternalDecoration, IOscLinkService, type IBufferResizeEvent } from 'common/services/Services';
|
||||
import { UnicodeService } from 'common/services/UnicodeService';
|
||||
import { clone } from 'common/Clone';
|
||||
import { DEFAULT_OPTIONS } from 'common/services/OptionsService';
|
||||
@@ -18,7 +18,7 @@ export class MockBufferService implements IBufferService {
|
||||
public serviceBrand: any;
|
||||
public get buffer(): IBuffer { return this.buffers.active; }
|
||||
public buffers: IBufferSet = {} as any;
|
||||
public onResize: Event<{ cols: number, rows: number }> = new Emitter<{ cols: number, rows: number }>().event;
|
||||
public onResize: Event<IBufferResizeEvent> = new Emitter<IBufferResizeEvent>().event;
|
||||
public onScroll: Event<number> = new Emitter<number>().event;
|
||||
private readonly _onScroll = new Emitter<number>();
|
||||
public isUserScrolling: boolean = false;
|
||||
|
||||
@@ -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