Skip to content

feat: highlight matches in interactive search #2653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 4, 2025

Conversation

frankh
Copy link
Contributor

@frankh frankh commented Mar 28, 2025

fixes #503

highlight the matching parts of commands in the search window fzf style

sometimes it takes a while to be able to see why a command has shown up, this highlighting helps

it uses https://github.com/nomad/norm for fzf style matching which supports all the same prefixes we do except regex matches (which just won't highlight)

image
image
image

NOTE: PR is unfinished (need tests, probably a better way of getting the search input and engine into the renderer), but i wanted to make sure people would want this feature first

also, the highlighting is kind of inversed for the selected row, not sure if there's a better way we can do this though

edit: updated the highlighting to change the color on the selected row instead of unbolding:
image

Checks

  • I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle
  • I have checked that there are no existing pull requests for the same thing

frankh added 4 commits March 28, 2025 11:28
uses `norm` to do fzf-compatible matches when rendering history items
in the search panel to highlight the matching ranges of the item

this helps see _why_ certain history items have come up

note that this will never be 100% perfect as we search on a sqlite query
but it should be good enough in most cases
@frankh frankh force-pushed the frank/highlight-matches branch 3 times, most recently from 440900d to f608f2c Compare March 28, 2025 13:04
@frankh frankh force-pushed the frank/highlight-matches branch from f608f2c to 9bdd7e5 Compare March 28, 2025 13:21
@frankh
Copy link
Contributor Author

frankh commented Apr 2, 2025

@ellie pls

@ellie
Copy link
Member

ellie commented Apr 3, 2025

jusssst holding off on this one - i'd like to get 18.5 stable out this week and would like to give this some proper testing for 18.6! sorry for the delay

@frankh
Copy link
Contributor Author

frankh commented Apr 4, 2025

no worries just wanted to make sure it wasn't forgotten :)

ellie
ellie previously approved these changes Aug 4, 2025
Copy link
Member

@ellie ellie left a comment

Choose a reason for hiding this comment

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

ok i DID forget this one in the end, so sorry! looks great though and i'm excited to have it in 🚀

thank you for the work!

@ellie ellie enabled auto-merge (squash) August 4, 2025 14:59
@ellie ellie merged commit 3cf4ff8 into atuinsh:main Aug 4, 2025
19 checks passed
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.

Feature: Highlighting search inclusions like fzf do
2 participants