Skip to content

feat: navigate the tag autocomplete with the arrow keys (#177) - #223

Merged
matheuswhite merged 1 commit into
mainfrom
feat/177-tag-navigation
Jul 19, 2026
Merged

feat: navigate the tag autocomplete with the arrow keys (#177)#223
matheuswhite merged 1 commit into
mainfrom
feat/177-tag-navigation

Conversation

@matheuswhite

Copy link
Copy Markdown
Owner

Closes #177.

Problem

When the @tag autocomplete pop-up is open there is no way to move through the list — the only way to reach a tag is to type it until it becomes the first entry, which is tedious for long tag names or long lists.

Solution

While the pop-up is showing, the arrow keys drive it:

  • ↑ / ↓ move a visible highlight through the list (overriding command-history navigation, which is restored the moment the pop-up is not showing).
  • The highlighted entry is drawn as a full-width cyan bar so the current selection is unmistakable.
  • Tab completes the highlighted entry instead of always the first one.

The list also windows around the selection so the highlight stays on screen, with a trailing ... when more entries exist below.

Implementation

  • TagList gains a selected index with select_next/select_prev (clamped at both ends), selected(), get_selected_autocomplete() and has_suggestions(). The index resets to the top whenever the list is rebuilt (every keystroke) and on clear().
  • inputs_task.rs: the Up/Down arms branch on has_suggestions() before falling through to history; handle_tab_input uses the selected entry.
  • graphics_task.rs: draw_autocomplete_list windows the list around the selection and highlights the selected row.

Testing

  • 6 new unit tests in infra/tags.rs for selection navigation, clamping, reset-on-rebuild and has_suggestions.
  • New e2e test tag_autocomplete_down_arrow_then_tab_completes_selected_tag (tests/tui_e2e.rs): @ta → ↓ → Tab resolves to @tag2.
  • Full suite green: 185 unit tests, 11 e2e (1 pre-existing macOS-only ignore). Verified manually in the real TUI (highlight, ↑/↓, clamp, window scroll, Tab of the selected item).

🤖 Generated with Claude Code

When the tag pop-up is open, Up/Down now move a visible highlight through
the list instead of the command history, and Tab completes the highlighted
entry rather than always the first one. Outside the pop-up the arrows still
walk the command history as before.

`TagList` carries the selected index; it resets to the top whenever the list
is rebuilt (every keystroke) and clamps at both ends. The pop-up windows the
list around the selection so the highlight is always on screen, with a
trailing `...` when more entries exist below.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@matheuswhite
matheuswhite merged commit 8f3cd73 into main Jul 19, 2026
8 checks passed
@matheuswhite
matheuswhite deleted the feat/177-tag-navigation branch July 19, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Navigation through command tags

1 participant