Skip to content
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

Feature Request: Fuzzy Search #5314

Open
iliazlobin opened this issue Apr 10, 2020 · 3 comments
Open

Feature Request: Fuzzy Search #5314

iliazlobin opened this issue Apr 10, 2020 · 3 comments
Assignees
Labels
Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.
Milestone

Comments

@iliazlobin
Copy link

An innate feature to search through the Terminal text is quite limited and basic:

  • it doesn't highlight several entries in the window;
  • it doesn't support using regular expressions;
  • it can't filter output to a fewer number of lines (much like grep does).
  • it only supports strict match;

With the power of fuzzy search, users gain a boost to their productivity of being able to find a text through history very fast. It's implemented in many text editors (JetBrains IDEA, Visual Studio Code) for their project's files search. There's a solution specifically for the command line (bash/zsh) as well - junegunn/fzf.

If we could integrate the feature into the terminal (via its UI) without relying on the bash settings, it would be a great capability!

@iliazlobin iliazlobin added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Apr 10, 2020
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Apr 10, 2020
@zadjii-msft
Copy link
Member

Thanks for the suggestion! There are certainly parts of your request that are already being tracked in #3920, but I'll use this issue to specifically track implementing "fuzzy search". Thanks!

@zadjii-msft zadjii-msft added Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. and removed Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. labels Apr 10, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Apr 10, 2020
@zadjii-msft zadjii-msft added this to the Terminal Backlog milestone Apr 10, 2020
@KaiyuWang16 KaiyuWang16 mentioned this issue Apr 10, 2020
20 tasks
@zadjii-msft zadjii-msft mentioned this issue Apr 15, 2020
@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Apr 17, 2020
@carlos-zamora carlos-zamora self-assigned this May 12, 2020
@zadjii-msft zadjii-msft modified the milestones: Terminal Backlog, Backlog Jan 4, 2022
@zadjii-msft
Copy link
Member

@lhecker Just a thought scrolling through the backlog: how hard is this (fzf like search in terminal) now that we've got #15858?

Could we just (behind the scenes) convert something like foo into \b.*?f.*?o.*?o.*?\b? (I'm sure there's a better regex)

@lhecker
Copy link
Member

lhecker commented Aug 31, 2023

Hmm, I'm not sure. A fuzzy matcher would sort results by their closeness to the needle. That would mean we would need to still implement a different searcher to rank them. fzf uses a variant of the Smith–Waterman algorithm which we could implement as well. I think something like that would be a requirement for this issue.

But I think #15858 is still helpful for this issue. Since it presents a view into the TextBuffer as if it was a single contiguous string, and because it provides facilities to map character positions back to row/column indices, we can now implement such string search algorithms much easier now.
ICU offers utext based APIs like UTEXT_NEXT32 to return the next UTF-32 character, u_foldCase to turn it into a consistent casing and then we can just feed it into the Smith–Waterman algorithm. Alternatively there's also grapheme cluster iterators, etc.

@e82eric e82eric mentioned this issue Jan 22, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

5 participants