Skip to content

fix(tui): apply path/@ completion on Enter#13590

Merged
OutThisLife merged 1 commit into
mainfrom
bb/tui-enter-applies-path-completion
Apr 21, 2026
Merged

fix(tui): apply path/@ completion on Enter#13590
OutThisLife merged 1 commit into
mainfrom
bb/tui-enter-applies-path-completion

Conversation

@OutThisLife

@OutThisLife OutThisLife commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

From TUI blitz-test feedback: "Using @ to select a file, then hitting enter on the file, does not insert the file but sends the incomplete message as is."

Summary

  • submit() gated completion-on-Enter to value.startsWith('/'), so @file, ./path, ~/path, and /absolute/… completions fell through and submitted the draft instead of inserting the highlighted row.
  • Guard on completions.length && compReplace > 0useCompletion already scopes population to slash and path tokens, and the next !== value check keeps plain-text submits working when the completion is already applied.

Test plan

  • npm run type-check clean
  • npm test — 152/152 pass
  • Manual: type @<partial>, Up/Down to pick file, Enter — expect insert, not submit
  • Manual: type /h, Enter — expect slash completion still applies (parity)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Enter-key behavior so that, when a completion row is highlighted, Enter applies the completion instead of submitting the draft message.

Changes:

  • Adjusts submit() completion-on-Enter gating logic to trigger beyond just slash-prefixed inputs.
  • Updates how the inserted completion text is normalized when both the input and completion start with /.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/src/app/useSubmission.ts Outdated
Comment thread ui-tui/src/app/useSubmission.ts Outdated
@OutThisLife OutThisLife force-pushed the bb/tui-enter-applies-path-completion branch 2 times, most recently from 30f89ac to b4f1bef Compare April 21, 2026 16:16
@OutThisLife OutThisLife requested a review from Copilot April 21, 2026 16:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

ui-tui/src/app/useSubmission.ts:245

  • submit() now attempts to apply a completion whenever composerState.completions.length is non-zero, but useCompletion() clears completions via a useEffect. This means completions from a previous input value can survive for one render; if the user types something that no longer matches slash/path completion triggers and immediately presses Enter, a stale completion can be inserted (because next !== value) instead of submitting. Consider gating this block with the same predicate used by useCompletion (e.g., value.startsWith('/') OR TAB_PATH_RE match) or exposing an isCompletionActiveForInput(value) helper from useCompletion so submit() only applies completions when they're relevant to the current value.
      if (composerState.completions.length) {
        const row = composerState.completions[composerState.compIdx]

        if (row?.text) {
          const text = value.startsWith('/') && row.text.startsWith('/') ? row.text.slice(1) : row.text
          const next = value.slice(0, composerState.compReplace) + text

          if (next !== value) {
            return composerActions.setInput(next)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Completion selection on Enter was gated to slash commands only
(value.startsWith('/')), so @file, ./path, and ~/path completions fell
through and submitted the incomplete input instead of inserting the
highlighted row.

Guard on completions.length && compReplace > 0 — useCompletion already
scopes population to slash and path tokens, and the next !== value check
keeps plain-text submits working when the completion is already applied.
@OutThisLife OutThisLife force-pushed the bb/tui-enter-applies-path-completion branch from 5fbb74d to 4b0686f Compare April 21, 2026 19:30
@alt-glitch alt-glitch added type/bug Something isn't working comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Apr 21, 2026
@OutThisLife OutThisLife merged commit c0db4d5 into main Apr 21, 2026
9 of 10 checks passed
@OutThisLife OutThisLife deleted the bb/tui-enter-applies-path-completion branch April 21, 2026 20:50
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
…applies-path-completion

fix(tui): apply path/@ completion on Enter
aj-nt pushed a commit to aj-nt/hermes-agent that referenced this pull request May 1, 2026
…applies-path-completion

fix(tui): apply path/@ completion on Enter
Luminet2023 pushed a commit to Luminet2023/hermes-agent that referenced this pull request May 1, 2026
…applies-path-completion

fix(tui): apply path/@ completion on Enter
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…applies-path-completion

fix(tui): apply path/@ completion on Enter
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…applies-path-completion

fix(tui): apply path/@ completion on Enter
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…applies-path-completion

fix(tui): apply path/@ completion on Enter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants