@xterm/xterm 6.1.0-beta.266 → 6.1.0-beta.268

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": "6.1.0-beta.266",
4
+ "version": "6.1.0-beta.268",
5
5
  "main": "lib/xterm.js",
6
6
  "module": "lib/xterm.mjs",
7
7
  "style": "css/xterm.css",
@@ -116,5 +116,5 @@
116
116
  "ws": "^8.20.0",
117
117
  "xterm-benchmark": "^0.3.2"
118
118
  },
119
- "commit": "59264f1f5b333c8d672b69f6c8fb7c5cd381f660"
119
+ "commit": "4226e64245bbf0612a94d81c907fe11cf1065b9a"
120
120
  }
@@ -505,7 +505,7 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
505
505
  this.textarea,
506
506
  parent.ownerDocument.defaultView ?? window,
507
507
  // Force unsafe null in node.js environment for tests
508
- this._document ?? (typeof window !== 'undefined') ? window.document : null as any
508
+ this._document ?? ((typeof window !== 'undefined') ? window.document : null as any)
509
509
  ));
510
510
  this._instantiationService.setService(ICoreBrowserService, this._coreBrowserService);
511
511
 
@@ -23,7 +23,7 @@ export class RenderDebouncer implements IRenderDebouncerWithCallback {
23
23
  }
24
24
 
25
25
  public dispose(): void {
26
- if (this._animationFrame) {
26
+ if (this._animationFrame !== undefined) {
27
27
  this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame);
28
28
  this._animationFrame = undefined;
29
29
  }
@@ -31,9 +31,7 @@ export class RenderDebouncer implements IRenderDebouncerWithCallback {
31
31
 
32
32
  public addRefreshCallback(callback: FrameRequestCallback): number {
33
33
  this._refreshCallbacks.push(callback);
34
- if (!this._animationFrame) {
35
- this._animationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh());
36
- }
34
+ this._animationFrame ??= this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh());
37
35
  return this._animationFrame;
38
36
  }
39
37
 
@@ -46,7 +44,7 @@ export class RenderDebouncer implements IRenderDebouncerWithCallback {
46
44
  this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart;
47
45
  this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd;
48
46
 
49
- if (this._animationFrame) {
47
+ if (this._animationFrame !== undefined) {
50
48
  return;
51
49
  }
52
50
 
@@ -3,10 +3,10 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- const RENDER_DEBOUNCE_THRESHOLD_MS = 1000; // 1 Second
7
-
8
6
  import { IRenderDebouncer } from './Types';
9
7
 
8
+ const RENDER_DEBOUNCE_THRESHOLD_MS = 1000; // 1 Second
9
+
10
10
  /**
11
11
  * Debounces calls to update screen readers to update at most once configurable interval of time.
12
12
  */
@@ -31,7 +31,9 @@ export class TimeBasedDebouncer implements IRenderDebouncer {
31
31
  public dispose(): void {
32
32
  if (this._refreshTimeoutID) {
33
33
  clearTimeout(this._refreshTimeoutID);
34
+ this._refreshTimeoutID = undefined;
34
35
  }
36
+ this._additionalRefreshRequested = false;
35
37
  }
36
38
 
37
39
  public refresh(rowStart: number | undefined, rowEnd: number | undefined, rowCount: number): void {
@@ -48,6 +50,11 @@ export class TimeBasedDebouncer implements IRenderDebouncer {
48
50
  const refreshRequestTime: number = performance.now();
49
51
  if (refreshRequestTime - this._lastRefreshMs >= this._debounceThresholdMS) {
50
52
  // Enough time has elapsed since the last refresh; refresh immediately
53
+ if (this._refreshTimeoutID !== undefined) {
54
+ clearTimeout(this._refreshTimeoutID);
55
+ this._refreshTimeoutID = undefined;
56
+ this._additionalRefreshRequested = false;
57
+ }
51
58
  this._lastRefreshMs = refreshRequestTime;
52
59
  this._innerRefresh();
53
60
  } else if (!this._additionalRefreshRequested) {
@@ -37,10 +37,6 @@ export function getCoords(window: Pick<Window, 'getComputedStyle'>, event: Pick<
37
37
  }
38
38
 
39
39
  const coords = getCoordsRelativeToElement(window, event, element);
40
- if (!coords) {
41
- return undefined;
42
- }
43
-
44
40
  coords[0] = Math.ceil((coords[0] + (isSelection ? cssCellWidth / 2 : 0)) / cssCellWidth);
45
41
  coords[1] = Math.ceil(coords[1] / cssCellHeight);
46
42
 
@@ -156,7 +156,7 @@ function wrappedRowsForRow(currentRow: number, bufferService: IBufferService): n
156
156
  */
157
157
  function horizontalDirection(startX: number, startY: number, targetX: number, targetY: number, bufferService: IBufferService, applicationCursor: boolean): Direction {
158
158
  let startRow;
159
- if (moveToRequestedRow(targetX, targetY, bufferService, applicationCursor).length > 0) {
159
+ if (moveToRequestedRow(startY, targetY, bufferService, applicationCursor).length > 0) {
160
160
  startRow = targetY - wrappedRowsForRow(targetY, bufferService);
161
161
  } else {
162
162
  startRow = startY;
@@ -694,7 +694,7 @@ class CursorBlinkStateManager {
694
694
  }
695
695
 
696
696
  private _clearIdleTimer(): void {
697
- if (this._idleTimeout) {
697
+ if (this._idleTimeout !== undefined) {
698
698
  this._coreBrowserService.window.clearTimeout(this._idleTimeout);
699
699
  this._idleTimeout = undefined;
700
700
  }
@@ -6,4 +6,4 @@
6
6
  /**
7
7
  * The xterm.js version. This is updated by the publish script from package.json.
8
8
  */
9
- export const XTERM_VERSION = '6.1.0-beta.266';
9
+ export const XTERM_VERSION = '6.1.0-beta.268';