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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

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 :)

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