Skip to content

Commit 0ab8e0c

Browse files
committed
fix: terminal selection loss
1 parent 16879db commit 0ab8e0c

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

apps/desktop/src/hooks/useAppState.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,6 @@ export function useAppState(
581581
if (!isRuntimeVisible(runtime)) {
582582
return false;
583583
}
584-
runtime.term.clearSelection();
585584
requestAnimationFrame(() => {
586585
runtime.term?.focus();
587586
});
@@ -768,7 +767,7 @@ export function useAppState(
768767
}
769768
const appearance = toTerminalAppearance(configRef.current.settings);
770769
applyTerminalAppearanceToRuntime(runtime, appearance);
771-
if (options?.clearSelection !== false) {
770+
if (options?.clearSelection) {
772771
runtime.term.clearSelection();
773772
}
774773
if (options?.focus) {
@@ -1328,7 +1327,7 @@ export function useAppState(
13281327
}
13291328
const runtime = runtimeRef.current.get(sessionId)?.[kind];
13301329
if (runtime?.term) {
1331-
activateVisibleRuntime(runtime, sessionId, kind, { focus: true, clearSelection: true });
1330+
activateVisibleRuntime(runtime, sessionId, kind, { focus: true, clearSelection: false });
13321331
return;
13331332
}
13341333
if (!focusSession(sessionId, kind)) {
@@ -1410,7 +1409,7 @@ export function useAppState(
14101409
pendingFocusRef.current = null;
14111410
}
14121411
if (isActiveRuntime) {
1413-
activateVisibleRuntime(runtime, sessionId, kind, { focus: true, clearSelection: true });
1412+
activateVisibleRuntime(runtime, sessionId, kind, { focus: true, clearSelection: false });
14141413
} else {
14151414
activateRuntime(runtime, { focus: false, clearSelection: false });
14161415
}
@@ -1976,7 +1975,7 @@ export function useAppState(
19761975
const kind = activePaneKindRef.current;
19771976
const runtime = runtimeRef.current.get(sessionId)?.[kind];
19781977
if (runtime?.term) {
1979-
activateVisibleRuntime(runtime, sessionId, kind, { focus: true, clearSelection: true });
1978+
activateVisibleRuntime(runtime, sessionId, kind, { focus: true, clearSelection: false });
19801979
return;
19811980
}
19821981
if (!focusSession(sessionId, kind)) {

0 commit comments

Comments
 (0)