Skip to content

feat(tui): open fuzzy prompt history search on ctrl+r and move markdown toggle to ctrl+m - #1417

Merged
edenreich merged 3 commits into
mainfrom
fix/issue-1412
Sep 30, 2026
Merged

edenreich merged 3 commits into
mainfrom
fix/issue-1412

Conversation

@inference-gateway-maintainer

@inference-gateway-maintainer inference-gateway-maintainer Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #1412

Summary

Ctrl+R in the chat view now opens an fzf-style fuzzy search over the current project's prompt history, and the raw markdown toggle moves to Ctrl+M (with an alt+m fallback that works in plain terminals). The overlay lists prompts newest first with duplicates collapsed to their most recent occurrence, highlights matched characters using the existing sahilm/fuzzy + HighlightMatches helpers, and restores multi-line prompts with their original newlines. Enter loads the selected prompt into the input for editing without sending it, and Esc closes the overlay leaving the draft untouched (its Esc is consumed before the dispatcher, so it never counts toward the double-Esc go-back-in-time binding).

Changes

  • Added a configurable text_editing_history_search action (default ctrl+r, chat view context, gated on no pending approval) in config/keybindings.go and the keybinding registry, so infer keybindings list, the help view and infer keybindings validate pick it up automatically.
  • Changed display_toggle_raw_format defaults from ctrl+r to ctrl+m plus alt+m, and removed ctrl+m from the textarea InsertNewline keymap; Ctrl+R refresh in the /diff viewer and file explorer is untouched (they resolve their own keys outside the chat view).
  • New components.HistorySearchView overlay rendered above the input: query line, up to 7 visible rows with more-above/below hints, fuzzy filtering with bold+underline highlights, wrap-around selection, no-match empty state, and multiline prompts flattened to one row with a return glyph while keeping the original text on Enter.
  • Added history.Store.GetAllHistory() as the read accessor over allHistory; ChatApplication opens the overlay from a HistorySearchOpenEvent emitted by the keybinding handler, holds key focus (mirroring the attachments/status-bar guards), hides the autocomplete while open, and applies the accepted prompt via SetText/SetCursor.
  • Unit tests cover dedupe/newest-first ordering, case-insensitive fuzzy filtering with matched indexes, selection wrap-around, Enter loading (including multi-line), Esc closing without touching the input, empty-state backspace recovery, the double-Esc regression, and the changed defaults; existing registry tests updated for the new Ctrl+R and Ctrl+M behavior.
  • Documented the new action and the changed default (including the Kitty-keyboard-protocol caveat) in docs/configuration-reference.md.

Release note: this changes a widely used default binding - Ctrl+R now searches prompt history and toggling raw/rendered markdown is Ctrl+M (or alt+m anywhere). Users who already overrode display_toggle_raw_format in keybindings.yaml keep their keys.

Follow-up docs ticket: inference-gateway/docs#868

…wn toggle to ctrl+m

ctrl+r now opens an fzf-style fuzzy search over the project prompt history. Typing filters the list with matched characters highlighted, up/down moves the selection, enter loads the selected prompt into the input for editing without sending it, and esc closes the overlay without touching the draft.

display_toggle_raw_format now defaults to ctrl+m plus alt+m as a terminal-safe fallback, and ctrl+m is removed from the textarea InsertNewline keymap. Terminals without the kitty keyboard protocol still report ctrl+m as enter, so alt+m works everywhere.
…earch

infer init seeds keybindings.yaml with every default, so a file created before the ctrl+r change still binds display_toggle_raw_format to ctrl+r. The raw toggle is registered first and wins the key, which keeps the history search from opening. Document the two commands that fix an existing file.
…rence

The note is not needed. This restores docs/configuration-reference.md to its state in 110a3e9.
@edenreich
edenreich merged commit 7c16337 into main Sep 30, 2026
12 checks passed
@edenreich
edenreich deleted the fix/issue-1412 branch September 30, 2026 00:05
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.219.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Ctrl+R opens fuzzy history search, raw markdown toggle moves to Ctrl+M

1 participant