opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: Ctrl+R to search and navigate prompt history instead of just arrow keys

Open Jasperabez opened this issue 1 month ago • 9 comments

Feature hasn't been suggested before.

  • [x] I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Implement something similar to reverse-i-search on bash. Image

Benefits:

  • instead of using arrow keys to find a previous prompt executed and resend that prompt, do a reverse search and load it into the prompt box. Saves time.

Jasperabez avatar Dec 04 '25 14:12 Jasperabez

This issue might be a duplicate of existing issues. Please check:

  • #1701: Feature request: history reverse search like curses-based TUIs

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Dec 04 '25 14:12 github-actions[bot]

+1 need it

jiahaoxiang2000 avatar Dec 18 '25 02:12 jiahaoxiang2000

This is a good idea

rekram1-node avatar Dec 18 '25 16:12 rekram1-node

If anyone wants to make a pr i think this would be a good addition

rekram1-node avatar Dec 18 '25 16:12 rekram1-node

If anyone wants to make a pr i think this would be a good addition

@rekram1-node we create PR #5775 , thanks to review it.

jiahaoxiang2000 avatar Dec 19 '25 02:12 jiahaoxiang2000

@jiahaoxiang2000 I checked the pr you created out of curiosity and found an issue with the onSelect logic you should should offset the cursor logic otherwise the ui will only show one line if you have a multline input input.cursorOffset = input.plainText.length

It's not my place to say but with just showing truncated text i don't see how this will be very useful since its very confusing without seeing the full text content as to what was written in a previous prompt. Image

With the UI you went with I ran opus 4.5 to get some dummy ui for a version with full context and suggested a ui similar to fzf --preview but @rekram1-node could give better feedback here as to what they would want. Maybe just simple search style like bash where you search and it shows on the input instantly instead of opening history modal. Image

ShpetimA avatar Dec 19 '25 22:12 ShpetimA

I checked the pr you created out of curiosity and found an issue with the onSelect logic you should should offset the cursor logic otherwise the ui will only show one line if you have a multline input input.cursorOffset = input.plainText.length

we had fix this, https://github.com/sst/opencode/pull/5775/commits/38b567a2f1bab4e3549da861e32b6e6f2e8fab41 in #5775 , very thank @ShpetimA .

jiahaoxiang2000 avatar Dec 20 '25 01:12 jiahaoxiang2000

@ShpetimA Claude code v2.0.70 used the full context and suggested you talked

Image

jiahaoxiang2000 avatar Dec 24 '25 02:12 jiahaoxiang2000