Skip to content

Commit 0c7392e

Browse files
committed
fix: skip copy-on-select when search bar has focus
Navigating search results in the terminal causes xterm.js to change the selection programmatically, which was triggering copy-on-select and clobbering the clipboard. Skip the clipboard write when an element inside .search-container is the active element.
1 parent 7119970 commit 0c7392e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

frontend/app/view/term/termwrap.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,12 @@ export class TermWrap {
343343
if (!globalStore.get(copyOnSelectAtom)) {
344344
return;
345345
}
346+
// Don't copy-on-select when the search bar has focus — navigating
347+
// search results changes the terminal selection programmatically.
348+
const active = document.activeElement;
349+
if (active != null && active.closest(".search-container") != null) {
350+
return;
351+
}
346352
const selectedText = this.terminal.getSelection();
347353
if (selectedText.length > 0) {
348354
navigator.clipboard.writeText(selectedText);

0 commit comments

Comments
 (0)