summaryrefslogtreecommitdiffhomepage
path: root/packages/desktop/src
diff options
context:
space:
mode:
authorAdam <[email protected]>2025-12-18 20:29:21 -0600
committerAdam <[email protected]>2025-12-19 07:38:37 -0600
commite561f1ad68dcecd70ebd486f6ac03fb5ccf1e957 (patch)
tree02696a1e4abbbc92d889e772efe596eeecd82776 /packages/desktop/src
parentebfb98521590f75b843029e32a0506d38f5f08f9 (diff)
downloadopencode-e561f1ad68dcecd70ebd486f6ac03fb5ccf1e957.tar.gz
opencode-e561f1ad68dcecd70ebd486f6ac03fb5ccf1e957.zip
fix(desktop): don't navigate prompt history if dirty
Diffstat (limited to 'packages/desktop/src')
-rw-r--r--packages/desktop/src/components/prompt-input.tsx11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/desktop/src/components/prompt-input.tsx b/packages/desktop/src/components/prompt-input.tsx
index ac56793f4..5c00f9f83 100644
--- a/packages/desktop/src/components/prompt-input.tsx
+++ b/packages/desktop/src/components/prompt-input.tsx
@@ -102,6 +102,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
imageAttachments: ImageAttachmentPart[]
mode: "normal" | "shell"
applyingHistory: boolean
+ userHasEdited: boolean
}>({
popover: null,
historyIndex: -1,
@@ -111,6 +112,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
imageAttachments: [],
mode: "normal",
applyingHistory: false,
+ userHasEdited: false,
})
const MAX_HISTORY = 100
@@ -139,6 +141,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
const applyHistoryPrompt = (p: Prompt, position: "start" | "end") => {
const length = position === "start" ? 0 : promptLength(p)
setStore("applyingHistory", true)
+ setStore("userHasEdited", false)
prompt.set(p, length)
requestAnimationFrame(() => {
editorRef.focus()
@@ -440,6 +443,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
if (shouldReset) {
setStore("popover", null)
+ setStore("userHasEdited", false)
if (store.historyIndex >= 0 && !store.applyingHistory) {
setStore("historyIndex", -1)
setStore("savedPrompt", null)
@@ -474,6 +478,10 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
setStore("savedPrompt", null)
}
+ if (!store.applyingHistory) {
+ setStore("userHasEdited", true)
+ }
+
prompt.set(rawParts, cursorPosition)
}
@@ -565,6 +573,8 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
}
const navigateHistory = (direction: "up" | "down") => {
+ if (store.userHasEdited) return false
+
const entries = history.entries
const current = store.historyIndex
@@ -696,6 +706,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
addToHistory(currentPrompt)
setStore("historyIndex", -1)
setStore("savedPrompt", null)
+ setStore("userHasEdited", false)
let existing = info()
if (!existing) {