fix/fill input - #453
Conversation
sudo-tee
commented
Jul 8, 2026
The history file was a remnant from the original repo this one was forked from (goose.nvim) But just scope it from the session would limit what you can do with it. Sometimes I start new sessions but want to send a prompt I already sent in another. But they should be scoped per project at least. |
phanen
commented
Jul 9, 2026
This pr currently make history picker per-session since it's just wrapper on timeline picker. Maybe we can have a action for history to toggle session/project/... Also maybe each session should have persistent draft message if tui support this (i don't often use tui so i'm not sure) |
sudo-tee
commented
Jul 9, 2026
Can we split the 2 things that this PR addresses ? I really like the /undo fix. But for the history I would need to play with it and think about what is the best solution. Because opencode tui does the same history navigation as we do with arrows in the input. and it does not scope it per session either. The history picker in this plugin was just a view on the message history the user sent over time. |
6b6bb2b to
61afeecCompareFound another bug... msg is often truncated from the end opencode.nvim/lua/opencode/ui/renderer.lua Lines 368 to 370 in eebda20 opencode.nvim/lua/opencode/ui/renderer.lua Lines 87 to 101 in eebda20
opencode.nvim/lua/opencode/ui/renderer.lua Lines 375 to 377 in eebda20 and only when role is user opencode.nvim/lua/opencode/ui/renderer/events.lua Lines 291 to 292 in eebda20 but a canceled user messages sequence can be: so when there's many tool call, truncated msg won't contain user msg -> last_user_message will be never set. so sometimes |
Not sure if it's proper to add another set_last_user_message here... or make anther version of EDIT: llm suggest a another option to remove |
Problem: /undo sent the revert to the server but left the input buffer empty, forcing the user to retype the prompt to tweak it. Solution: capture the target message before reverting and refill the input buffer from its parts once the server acknowledges.
…evert Problem: state.last_user_message was a stored cursor that callers had to keep in sync from multiple sites, drifting whenever a path forgot to update it. Solution: drop the stored cursor and compute the next /undo target inline from state.messages + server.revert.
phanen
commented
Jul 10, 2026
I finally choose this direction since it feels proper and easy to go... |
sudo-tee
commented
Jul 10, 2026
Since we can restore running sessions, and the output is sliced, it might be a good isea to reconstruct from the messages instead set_last_user_messsage. it's worth a try at least |
sudo-tee
commented
Jul 10, 2026
Looks good to me. Thanks for the PR |
Uh oh!
There was an error while loading. Please reload this page.
* feat(session): refill prompt input after /undo Problem: /undo sent the revert to the server but left the input buffer empty, forcing the user to retype the prompt to tweak it. Solution: capture the target message before reverting and refill the input buffer from its parts once the server acknowledges. * refactor(session): derive /undo target from state.messages + server.revert Problem: state.last_user_message was a stored cursor that callers had to keep in sync from multiple sites, drifting whenever a path forgot to update it. Solution: drop the stored cursor and compute the next /undo target inline from state.messages + server.revert.
Not sure why all prompt history is stored in ~/.local/share/nvim/opencode/history.txt.
Ideally different session should have separate prompt history.
Maybe history can be deprecated in favor of timeline picker?