Fix selection expansion by retaining focused input selections during global key events (#20205)
parent
cc30bfc94b
commit
fa96cb9c6e
|
|
@ -299,7 +299,8 @@ function App(props: { onSnapshot?: () => Promise<string[]> }) {
|
||||||
|
|
||||||
useKeyboard((evt) => {
|
useKeyboard((evt) => {
|
||||||
if (!Flag.OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT) return
|
if (!Flag.OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT) return
|
||||||
if (!renderer.getSelection()) return
|
const sel = renderer.getSelection()
|
||||||
|
if (!sel) return
|
||||||
|
|
||||||
// Windows Terminal-like behavior:
|
// Windows Terminal-like behavior:
|
||||||
// - Ctrl+C copies and dismisses selection
|
// - Ctrl+C copies and dismisses selection
|
||||||
|
|
@ -323,6 +324,11 @@ function App(props: { onSnapshot?: () => Promise<string[]> }) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const focus = renderer.currentFocusedRenderable
|
||||||
|
if (focus?.hasSelection() && sel.selectedRenderables.includes(focus)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
renderer.clearSelection()
|
renderer.clearSelection()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue