opencode
opencode copied to clipboard
fix: record shell mode in history (resolves #5454)
Fixes bug 1 from issue #5454 where shell commands were not properly recalled from message history. Previously, when typing a shell command such as, e.g., !date, only the date text was stored in history, not the shell mode. When recalling with up arrow, this caused the command to be sent as a text message to the model instead of executed as a shell command. With this PR, the shell mode state is recorded alongside the message so that it is properly restored when cycling through the command history.
Changes:
- Add optional
modefield to PromptInfo type - Store current mode when appending to history
- Restore mode (defaulting to 'normal' for backward compatibility) when recalling from history
Resolves #5454 (at least, the 'bug 1' part of it).