diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx index 249a48d358b..d86b7e9dd79 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx @@ -900,10 +900,7 @@ export function Prompt(props: PromptProps) { } if (store.mode === "normal") autocomplete.onKeyDown(e) if (!autocomplete.visible) { - if ( - (keybind.match("history_previous", e) && input.cursorOffset === 0) || - (keybind.match("history_next", e) && input.cursorOffset === input.plainText.length) - ) { + if (keybind.match("history_previous", e) || keybind.match("history_next", e)) { const direction = keybind.match("history_previous", e) ? -1 : 1 const item = history.move(direction, input.plainText) @@ -913,15 +910,10 @@ export function Prompt(props: PromptProps) { setStore("mode", item.mode ?? "normal") restoreExtmarksFromParts(item.parts) e.preventDefault() - if (direction === -1) input.cursorOffset = 0 - if (direction === 1) input.cursorOffset = input.plainText.length + input.cursorOffset = input.plainText.length } return } - - if (keybind.match("history_previous", e) && input.visualCursor.visualRow === 0) input.cursorOffset = 0 - if (keybind.match("history_next", e) && input.visualCursor.visualRow === input.height - 1) - input.cursorOffset = input.plainText.length } }} onSubmit={submit}