The open source coding agent.
TypeScript
fix(desktop): prompt history navigation
Adam9aa5460a0e12
diff --git a/packages/desktop/src/components/prompt-input.tsx b/packages/desktop/src/components/prompt-input.tsxindex 6bd3127bef4..a04211a9804 100644--- a/packages/desktop/src/components/prompt-input.tsx+++ b/packages/desktop/src/components/prompt-input.tsx@@ -593,23 +593,24 @@ export const PromptInput: Component<PromptInputProps> = (props) => {if (event.key === "ArrowUp" || event.key === "ArrowDown") {if (event.altKey || event.ctrlKey || event.metaKey) return- const { collapsed, cursorPosition, textLength } = getCaretState()+ const { collapsed } = getCaretState()if (!collapsed) return++ const cursorPosition = getCursorPosition(editorRef)+ const textLength = promptLength(prompt.current())const inHistory = store.historyIndex >= 0- const atAbsoluteStart = cursorPosition === 0- const atAbsoluteEnd = cursorPosition === textLength- const allowUp = (inHistory && atAbsoluteEnd) || atAbsoluteStart- const allowDown = (inHistory && atAbsoluteStart) || atAbsoluteEnd+ const atStart = cursorPosition <= 0+ const atEnd = cursorPosition >= textLengthif (event.key === "ArrowUp") {- if (!allowUp) return+ if (!atStart && !(inHistory && atEnd)) returnif (navigateHistory("up")) {event.preventDefault()}return}- if (!allowDown) return+ if (!atEnd && !(inHistory && atStart)) returnif (navigateHistory("down")) {event.preventDefault()}