Skip to content

Commit 4043b22

Browse files
committed
fix(tui): preserve arguments when executing commands via keybind
Add guard in onContentChange to skip redundant store updates, preventing programmatic updates from set() being overwritten. Also removes debug console.log statement.
1 parent 04ba91e commit 4043b22

File tree

1 file changed

+2
-1
lines changed
  • packages/opencode/src/cli/cmd/tui/component/prompt

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,6 @@ export function Prompt(props: PromptProps) {
546546
inputText.startsWith("/") &&
547547
iife(() => {
548548
const command = inputText.split(" ")[0].slice(1)
549-
console.log(command)
550549
return sync.data.command.some((x) => x.name === command)
551550
})
552551
) {
@@ -769,6 +768,8 @@ export function Prompt(props: PromptProps) {
769768
maxHeight={6}
770769
onContentChange={() => {
771770
const value = input.plainText
771+
// Skip redundant updates - prevents overwriting programmatic updates from set()
772+
if (value === store.prompt.input) return
772773
setStore("prompt", "input", value)
773774
autocomplete.onInput(value)
774775
syncExtmarksWithPromptParts()

0 commit comments

Comments
 (0)