Skip to content

fix(input): keep the @file mention highlight on a visible row - #1426

Merged
will-lamerton merged 3 commits into
Nano-Collective:mainfrom
addyCooks:fix/file-mention-window-1405
Sep 23, 2026
Merged

will-lamerton merged 3 commits into
Nano-Collective:mainfrom
addyCooks:fix/file-mention-window-1405

Conversation

@addyCooks

@addyCooks addyCooks commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Closes #1405.

The @ file mention list always rendered the first 5 matches (fileCompletions.slice(0, 5)), but Up/Down moved the selection over the whole list of up to 20. Past the fifth row the ▸ highlight disappeared from the visible list, and Tab inserted a file that was never shown.

The slash-command list already solves this by showing a window around the selected row. That logic is now one shared function, completionWindow, and both lists use it:

  • the file list shows 5 rows around the selection, so the highlighted file is always visible
  • when there are more than 5 matches, it shows Showing X-Y of Z, like the command list
  • each row's key is now the file path instead of its position in the list, since that position changes as the list scrolls

The slash-command list behaves exactly as before.

Recording

B16-FIXED-file-autocomplete-window

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changeset

  • Added a changeset (pnpm changeset) describing this change for the changelog

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover both success and error scenarios

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

Checklist

  • If this was for an open issue, I was assigned to it
  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging (see CONTRIBUTING.md)

The file mention list always rendered the first 5 matches while Up/Down
moved over all of them (up to 20), so past the fifth row the highlight
vanished and Tab could insert a file that was never shown. Window the
list around the selection with the same logic the slash command list
uses, now shared as completionWindow, and show "Showing X-Y of Z" when
there are more matches than rows.

Closes Nano-Collective#1405.
@github-actions

Copy link
Copy Markdown
Contributor

nc-review: nothing to raise

@addyCooks — nothing to raise from the automated review.

The diff factors out the existing slash-command list's window logic into a shared completionWindow helper and applies it to the @ file-mention list, so the highlighted row is always visible and Tab can no longer insert a file that was never rendered. The command list is unchanged in behavior, the file list now shows 'Showing X-Y of Z' past 5 matches, and a new spec exercises the regression (8 files, 7 Down presses, assert the highlight stays on a drawn row and the indicator scrolls). Correct, complete, and ready.


🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional

Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with /re-review.

@github-actions github-actions Bot added the agent:clean nc-review had nothing to raise label Sep 21, 2026
@will-lamerton

Copy link
Copy Markdown
Member

Beautiful work @addyCooks :)

@will-lamerton
will-lamerton merged commit 09d820d into Nano-Collective:main Sep 23, 2026
16 checks passed
@addyCooks

Copy link
Copy Markdown
Collaborator Author

Thankyou @will-lamerton,
Really appreciate it : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:clean nc-review had nothing to raise area:tui Terminal UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] @file mention autocomplete highlight vanishes past the 5th item, so Tab can insert a file that was never shown

2 participants