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

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.135",
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": "9fce06726672f3aa9a8d5482ca72e7ce1dcd18de"
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 {
@@ -445,7 +445,10 @@ export class InputHandler extends Disposable implements IInputHandler {
445
445
 
446
446
  // Log debug data, the log level gate is to prevent extra work in this hot path
447
447
  if (this._logService.logLevel <= LogLevelEnum.DEBUG) {
448
- this._logService.debug(`parsing data${typeof data === 'string' ? ` "${data}"` : ` "${Array.prototype.map.call(data, e => String.fromCharCode(e)).join('')}"`}`, typeof data === 'string'
448
+ this._logService.debug(`parsing data ${typeof data === 'string' ? ` "${data}"` : ` "${Array.prototype.map.call(data, e => String.fromCharCode(e)).join('')}"`}`);
449
+ }
450
+ if (this._logService.logLevel === LogLevelEnum.TRACE) {
451
+ this._logService.trace(`parsing data (codes)`, typeof data === 'string'
449
452
  ? data.split('').map(e => e.charCodeAt(0))
450
453
  : data
451
454
  );
@@ -606,7 +609,7 @@ export class InputHandler extends Disposable implements IInputHandler {
606
609
  // since an empty cell is only set by fullwidth chars
607
610
  bufferRow.addCodepointToCell(this._activeBuffer.x - offset,
608
611
  code, chWidth);
609
- for (let delta = chWidth - oldWidth; --delta >= 0; ) {
612
+ for (let delta = chWidth - oldWidth; --delta >= 0;) {
610
613
  bufferRow.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, curAttr);
611
614
  }
612
615
  continue;
@@ -1622,7 +1625,7 @@ export class InputHandler extends Disposable implements IInputHandler {
1622
1625
  const text = bufferRow.getString(x);
1623
1626
  const data = new Uint32Array(text.length * length);
1624
1627
  let idata = 0;
1625
- for (let itext = 0; itext < text.length; ) {
1628
+ for (let itext = 0; itext < text.length;) {
1626
1629
  const ch = text.codePointAt(itext) || 0;
1627
1630
  data[idata++] = ch;
1628
1631
  itext += ch > 0xffff ? 2 : 1;
@@ -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;