Skip to content

Commit 894f172

Browse files
committed
fix(tui): restore variant_cycle keybind in prompt
Handle variant_cycle at element level in prompt's onKeyDown handler. Global useKeyboard doesn't receive events properly when textarea is focused, so this keybind must be handled locally. Fixes anomalyco#222
1 parent 47cc748 commit 894f172

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • packages/opencode/src/cli/cmd/tui/component/prompt

‎packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,15 @@ export function Prompt(props: PromptProps) {
10641064
}
10651065
}
10661066
if (store.mode === "normal") autocomplete.onKeyDown(e)
1067+
// Handle variant cycle before autocomplete visible check
1068+
// This must be at element level because global useKeyboard doesn't receive
1069+
// events properly when textarea is focused (see issue #222)
1070+
if (keybind.match("variant_cycle", e)) {
1071+
e.preventDefault()
1072+
if (local.model.variant.list().length === 0) return
1073+
local.model.variant.cycle()
1074+
return
1075+
}
10671076
if (!autocomplete.visible) {
10681077
if (
10691078
(keybind.match("history_previous", e) && input.cursorOffset === 0) ||

0 commit comments

Comments
 (0)