@xterm/xterm 5.6.0-beta.133 → 5.6.0-beta.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xterm/xterm",
3
3
  "description": "Full xterm terminal, in your browser",
4
- "version": "5.6.0-beta.133",
4
+ "version": "5.6.0-beta.134",
5
5
  "main": "lib/xterm.js",
6
6
  "module": "lib/xterm.mjs",
7
7
  "style": "css/xterm.css",
@@ -108,5 +108,5 @@
108
108
  "ws": "^8.2.3",
109
109
  "xterm-benchmark": "^0.3.1"
110
110
  },
111
- "commit": "1bf90d9f478f993362467a92f7d6197a22cba473"
111
+ "commit": "e9e8206467e10c2d9ca710ca49424e3f8d63d14a"
112
112
  }
@@ -152,6 +152,14 @@ export class SelectionService extends Disposable implements ISelectionService {
152
152
  this._register(toDisposable(() => {
153
153
  this._removeMouseDownListeners();
154
154
  }));
155
+
156
+ // Clear selection when resizing vertically. This experience could be improved, this is the
157
+ // simple option to fix the buggy behavior. https://github.com/xtermjs/xterm.js/issues/5300
158
+ this._register(this._bufferService.onResize(e => {
159
+ if (e.rowsChanged) {
160
+ this.clearSelection();
161
+ }
162
+ }));
155
163
  }
156
164
 
157
165
  public reset(): void {
@@ -7,7 +7,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
7
7
  import { IAttributeData, IBufferLine } from 'common/Types';
8
8
  import { BufferSet } from 'common/buffer/BufferSet';
9
9
  import { IBuffer, IBufferSet } from 'common/buffer/Types';
10
- import { IBufferService, IOptionsService } from 'common/services/Services';
10
+ import { IBufferService, IOptionsService, type IBufferResizeEvent } from 'common/services/Services';
11
11
  import { Emitter } from 'vs/base/common/event';
12
12
 
13
13
  export const MINIMUM_COLS = 2; // Less than 2 can mess with wide chars
@@ -22,7 +22,7 @@ export class BufferService extends Disposable implements IBufferService {
22
22
  /** Whether the user is scrolling (locks the scroll position) */
23
23
  public isUserScrolling: boolean = false;
24
24
 
25
- private readonly _onResize = this._register(new Emitter<{ cols: number, rows: number }>());
25
+ private readonly _onResize = this._register(new Emitter<IBufferResizeEvent>());
26
26
  public readonly onResize = this._onResize.event;
27
27
  private readonly _onScroll = this._register(new Emitter<number>());
28
28
  public readonly onScroll = this._onScroll.event;
@@ -43,12 +43,12 @@ export class BufferService extends Disposable implements IBufferService {
43
43
  }
44
44
 
45
45
  public resize(cols: number, rows: number): void {
46
+ const colsChanged = this.cols !== cols;
47
+ const rowsChanged = this.rows !== rows;
46
48
  this.cols = cols;
47
49
  this.rows = rows;
48
50
  this.buffers.resize(cols, rows);
49
- // TODO: This doesn't fire when scrollback changes - add a resize event to BufferSet and forward
50
- // event
51
- this._onResize.fire({ cols, rows });
51
+ this._onResize.fire({ cols, rows, colsChanged, rowsChanged });
52
52
  }
53
53
 
54
54
  public reset(): void {
@@ -18,7 +18,7 @@ export interface IBufferService {
18
18
  readonly buffer: IBuffer;
19
19
  readonly buffers: IBufferSet;
20
20
  isUserScrolling: boolean;
21
- onResize: Event<{ cols: number, rows: number }>;
21
+ onResize: Event<IBufferResizeEvent>;
22
22
  onScroll: Event<number>;
23
23
  scroll(eraseAttr: IAttributeData, isWrapped?: boolean): void;
24
24
  scrollLines(disp: number, suppressScrollEvent?: boolean): void;
@@ -26,6 +26,13 @@ export interface IBufferService {
26
26
  reset(): void;
27
27
  }
28
28
 
29
+ export interface IBufferResizeEvent {
30
+ cols: number;
31
+ rows: number;
32
+ colsChanged: boolean;
33
+ rowsChanged: boolean;
34
+ }
35
+
29
36
  export const ICoreMouseService = createDecorator<ICoreMouseService>('CoreMouseService');
30
37
  export interface ICoreMouseService {
31
38
  serviceBrand: undefined;