@xterm/xterm 6.1.0-beta.93 → 6.1.0-beta.95
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/lib/xterm.js +1 -1
- package/lib/xterm.js.map +1 -1
- package/lib/xterm.mjs +8 -8
- package/lib/xterm.mjs.map +3 -3
- package/package.json +2 -2
- package/src/browser/services/SelectionService.ts +8 -0
- package/src/common/InputHandler.ts +11 -2
- package/src/common/Version.ts +1 -1
- package/src/common/buffer/Buffer.ts +7 -0
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.
|
|
4
|
+
"version": "6.1.0-beta.95",
|
|
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.2.3",
|
|
117
117
|
"xterm-benchmark": "^0.3.1"
|
|
118
118
|
},
|
|
119
|
-
"commit": "
|
|
119
|
+
"commit": "8112fbf21051938530491fc298fd8ffca56978c8"
|
|
120
120
|
}
|
|
@@ -532,6 +532,9 @@ export class SelectionService extends Disposable implements ISelectionService {
|
|
|
532
532
|
* @param event The mouse event.
|
|
533
533
|
*/
|
|
534
534
|
private _handleSingleClick(event: MouseEvent): void {
|
|
535
|
+
// Track if there was a selection before clearing
|
|
536
|
+
const hadSelection = this.hasSelection;
|
|
537
|
+
|
|
535
538
|
this._model.selectionStartLength = 0;
|
|
536
539
|
this._model.isSelectAllActive = false;
|
|
537
540
|
this._activeSelectionMode = this.shouldColumnSelect(event) ? SelectionMode.COLUMN : SelectionMode.NORMAL;
|
|
@@ -543,6 +546,11 @@ export class SelectionService extends Disposable implements ISelectionService {
|
|
|
543
546
|
}
|
|
544
547
|
this._model.selectionEnd = undefined;
|
|
545
548
|
|
|
549
|
+
// Fire selection change event if a selection was cleared
|
|
550
|
+
if (hadSelection) {
|
|
551
|
+
this._fireOnSelectionChange(this._model.finalSelectionStart, this._model.finalSelectionEnd, false);
|
|
552
|
+
}
|
|
553
|
+
|
|
546
554
|
// Ensure the line exists
|
|
547
555
|
const line = this._bufferService.buffer.lines.get(this._model.selectionStart[1]);
|
|
548
556
|
if (!line) {
|
|
@@ -521,7 +521,13 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|
|
521
521
|
const wraparoundMode = this._coreService.decPrivateModes.wraparound;
|
|
522
522
|
const insertMode = this._coreService.modes.insertMode;
|
|
523
523
|
const curAttr = this._curAttrData;
|
|
524
|
-
let bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)
|
|
524
|
+
let bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
|
|
525
|
+
|
|
526
|
+
// Defensive check: bufferRow can be undefined if a resize occurred mid-write due to async
|
|
527
|
+
// scheduling gaps in WriteBuffer. See https://github.com/xtermjs/xterm.js/issues/5597
|
|
528
|
+
if (!bufferRow) {
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
525
531
|
|
|
526
532
|
this._dirtyRowTracker.markDirty(this._activeBuffer.y);
|
|
527
533
|
|
|
@@ -586,7 +592,10 @@ export class InputHandler extends Disposable implements IInputHandler {
|
|
|
586
592
|
this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)!.isWrapped = true;
|
|
587
593
|
}
|
|
588
594
|
// row changed, get it again
|
|
589
|
-
bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)
|
|
595
|
+
bufferRow = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
|
|
596
|
+
if (!bufferRow) {
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
590
599
|
if (oldWidth > 0 && bufferRow instanceof BufferLine) {
|
|
591
600
|
// Combining character widens 1 column to 2.
|
|
592
601
|
// Move old character to next line.
|
package/src/common/Version.ts
CHANGED
|
@@ -264,6 +264,13 @@ export class Buffer implements IBuffer {
|
|
|
264
264
|
this._cols = newCols;
|
|
265
265
|
this._rows = newRows;
|
|
266
266
|
|
|
267
|
+
// Ensure the cursor position invariant: ybase + y must be within buffer bounds
|
|
268
|
+
// This can be violated during reflow or when shrinking rows
|
|
269
|
+
if (this.lines.length > 0) {
|
|
270
|
+
const maxY = Math.max(0, this.lines.length - this.ybase - 1);
|
|
271
|
+
this.y = Math.min(this.y, maxY);
|
|
272
|
+
}
|
|
273
|
+
|
|
267
274
|
this._memoryCleanupQueue.clear();
|
|
268
275
|
// schedule memory cleanup only, if more than 10% of the lines are affected
|
|
269
276
|
if (dirtyMemoryLines > 0.1 * this.lines.length) {
|