diff --git a/packages/opencode/src/cli/cmd/tui/app.tsx b/packages/opencode/src/cli/cmd/tui/app.tsx index 713def2e5a..12f68a15c5 100644 --- a/packages/opencode/src/cli/cmd/tui/app.tsx +++ b/packages/opencode/src/cli/cmd/tui/app.tsx @@ -582,6 +582,15 @@ function App() { dialog.clear() }, }, + { + title: kv.get("clear_prompt_save_history", false) ? "Don't include cleared prompts in history" : "Include cleared prompts in history", + value: "app.toggle.clear_prompt_history", + category: "System", + onSelect: (dialog) => { + kv.set("clear_prompt_save_history", !kv.get("clear_prompt_save_history", false)) + dialog.clear() + }, + }, ]) createEffect(() => { 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 9032b0940c..801a236413 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx @@ -832,10 +832,12 @@ export function Prompt(props: PromptProps) { // If no image, let the default paste behavior continue } if (keybind.match("input_clear", e) && store.prompt.input !== "") { - history.append({ - ...store.prompt, - mode: store.mode, - }) + if (kv.get("clear_prompt_save_history", false)) { + history.append({ + ...store.prompt, + mode: store.mode, + }) + } input.clear() input.extmarks.clear() setStore("prompt", {