feat: slash command scrolling & tab completion (SEA-170)#697
Conversation
📝 WalkthroughWalkthroughAdds slash-command completion state, completion lookup helpers, ghost-text composer layout, renderer selection highlighting, and app key handling for navigating or accepting completions. New tests cover completion resolution, ghost rendering, and popup behavior. ChangesSlash-command completion UI
Sequence Diagram(s)Keyboard handling sequenceDiagram
participant User
participant handle_key
participant sync_slash_command_selection
participant handle_slash_command_popup_keys
participant slash_command_completion
participant Composer
User->>handle_key: paste or press popup key
handle_key->>sync_slash_command_selection: resync selection key
handle_key->>handle_slash_command_popup_keys: route Up / Down / Tab / Enter
handle_slash_command_popup_keys->>slash_command_completion: resolve selected completion
handle_slash_command_popup_keys->>Composer: insert completion or newline
Render-time ghost text sequenceDiagram
participant Renderer
participant slash_command_completion
participant Composer
participant render_slash_command_suggestions
Renderer->>slash_command_completion: compute ghost_text for current slash prefix
Renderer->>Composer: layout_with_ghost(ghost_text)
Renderer->>render_slash_command_suggestions: render selected row
Estimated review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Greptile SummaryThis PR adds keyboard-navigable slash command autocomplete to the TUI composer: Up/Down navigate a highlighted suggestion popup, inline ghost text previews the completion suffix, and Tab or Enter accepts the selected item. An exact-match Enter falls through to dispatch the command rather than completing it, and the slash popup is suppressed when the path-mention popup is open.
Confidence Score: 4/5Safe to merge with awareness of the exact-match Enter / paste-FSM interaction; fix before shipping to users who type rapidly or use terminal macros. The new ghost-text layout and suggestion-list logic are well-tested and correct. The one issue is in insert_selected_slash_command_or_newline: it ticks the paste FSM and then, for an exact command match, returns None so the key re-enters handle_composer_keys, which ticks the FSM a second time. The sub-millisecond gap between the two ticks always qualifies as a rapid keystroke, so one extra paste_burst_count increment is added on every exact-match Enter — under the right pre-existing burst state this silently activates paste mode and inserts a newline instead of dispatching the command. No test covers this path with the FSM enabled. crates/seal-tui/src/app.rs — specifically insert_selected_slash_command_or_newline and its interaction with the paste-detection FSM on the exact-match Enter path. Important Files Changed
Reviews (3): Last reviewed commit: "fix: fix `/reload` then down arrow not s..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/seal-tui/src/app.rs`:
- Around line 523-529: The navigation handler in app.rs is returning early from
slash_command_completion before processing the key event, which prevents Down
from moving off an exact-match suggestion like /reload. Update the logic around
App::sync_slash_command_selection and slash_command_completion so the result is
not required for navigation handling; only use the completion outcome when
needed for rendering or selection state, and allow the match on key.code to
continue even when slash_command_completion returns None.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d09df8ee-3ffa-4362-9625-f9768dac335a
📒 Files selected for processing (4)
crates/seal-tui/src/app.rscrates/seal-tui/src/composer.rscrates/seal-tui/src/renderer.rscrates/seal-tui/src/slash_commands.rs
|
Docs preview: https://06-24-sea-170.seal-docs.pages.dev |
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Fix all with cubic | Re-trigger cubic

Pull request
Summary
Adds keyboard-navigable slash command autocomplete to the TUI composer with inline ghost text and Tab/Enter to accept completions.
Related issues
Refs SEA-170
Changes
[hit \tab` to accept]`SlashCommandCompletionstruct carrying the replacement range, replacement text, and ghost textslash_command_completion,slash_command_selection_key, andactive_slash_commandhelpers inslash_commands.rslayout_with_ghosttoComposerto inject inline ghost text spans at the cursor position without a second layout walkTest plan
slash_command_down_and_tab_accept_selected_completion: Down then Tab replaces prefix with full commandslash_command_enter_accepts_selected_completion: Down then Enter completes without dispatchingslash_command_enter_in_paste_mode_inserts_newline: Enter in paste mode does not completeslash_command_up_after_command_args_moves_composer_cursor: Up with args present moves cursor to startslash_command_enter_on_exact_match_still_dispatches: Exact match Enter dispatches the slash command actionslash_completion_renders_inline_ghost_text: Renderer test confirms ghost text appears after typed prefixlayout_with_ghost_inserts_text_after_cursor: Composer layout unit test confirms ghost span position and cursor columncompletion_returns_replacement_and_ghost_text,completion_is_none_after_command_token,completion_is_none_inside_command_token,completion_is_none_for_exact_match: Unit tests forslash_command_completionedge cases