Skip to content

Commit fd09412

Browse files
zerone0xYansuclaude
authored
fix: prevent clipboard overwrite on single click without selection (#124)
The mouseup handler in SelectionManager was calling copyToClipboard() without first checking hasSelection(), causing single clicks on terminal cells to copy the character at that position to the clipboard. This overwrote the user's clipboard contents unexpectedly. Added a hasSelection() guard in the mouseup handler to match the pattern already used in the public copySelection() API. Fixes #108 Co-authored-by: Yansu <no-reply@yansu.ai> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 77e29d9 commit fd09412

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lib/selection-manager.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -550,10 +550,12 @@ export class SelectionManager {
550550
this.isSelecting = false;
551551
this.stopAutoScroll();
552552

553-
const text = this.getSelection();
554-
if (text) {
555-
this.copyToClipboard(text);
556-
this.selectionChangedEmitter.fire();
553+
if (this.hasSelection()) {
554+
const text = this.getSelection();
555+
if (text) {
556+
this.copyToClipboard(text);
557+
this.selectionChangedEmitter.fire();
558+
}
557559
}
558560
}
559561
};

0 commit comments

Comments
 (0)