Skip to content

addon-search: Add "Find Nth" functionality#5798

Open
boborrob wants to merge 1 commit intoxtermjs:masterfrom
boborrob:addon_search-arbitrary_access_to_matches
Open

addon-search: Add "Find Nth" functionality#5798
boborrob wants to merge 1 commit intoxtermjs:masterfrom
boborrob:addon_search-arbitrary_access_to_matches

Conversation

@boborrob
Copy link
Copy Markdown

@boborrob boborrob commented Apr 10, 2026

Summary:

Add "Find Nth" functionality to the terminal search feature in order to access matches arbitrarily.

Motivation:

For large sets of search results, cycling through matches sequentially can be cumbersome and time-consuming, especially when the location of the desired match is strongly suspected or known with precision. An input allows the user to jump arbitrarily to the desired match or to get closer to it much faster.

Changes:

  • Add an nthMatchPosition field to searchOptions for locating matches arbitrarily.

  • Add a findNth(...) method analogous to findNext(...) and findPrev(...).

  • Add baseline validations for nthMatchPosition (!isNaN, isTruthy, etc.). Rigorous validation is delegated to the client where the bounds are better understood pre-invocation.

  • Update demo app with 'Find Nth' search controls.

Example use cases:

VS Code terminalFindWidget

Screenshot_20260409_225319-2

Demo App Updates

Screenshot_20260409_224725

- Add an `nthMatchPosition` field to  `searchOptions` for locating matches arbitrarily.

- Add a `findNth(...)`  method analogous to  `findNext(...)` and `findPrev(...)`.

- Add baseline validations for `nthMatchPosition` (!isNaN, isTruthy, etc.).
  Rigorous validation is delegated to the client.

- Update demo app with 'Find Nth' search controls.
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.

1 participant