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

Live search preview #51

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

Conversation

quark-zju
Copy link
Contributor

@quark-zju quark-zju commented Jul 21, 2021

Preview search as user types. Similar to vim's hlsearch. This seems especially useful when using complex regexps.

This can replace `set_` APIs to make the APIs on Pager cleaner.
It makes the next change skip adding the `set_` API.
Make it possible to scroll_to a line without centering it. This will be
used by the next change.
Similar to the hlsearch feature from vim, show search results as user
types. This can be turned off via a config.
If the matched line is already in the current view, do not center it.
This reduces scrolling in search live preview.

It seems to be a general good default so I didn't add a config option.
This resolves some rendering issues where the search and prompt bar does
not get re-rendered properly. Repro steps:

1. sp src/screen.rs.
2. Search for 'crate'. 'crate' gets highlighted.
3. Search for 'foo' (no result). Keep the prompt.
4. Ctrl+W. Prompt does not erase the 'foo'. Search status shows 'foo'
   instead of expecte 'crate'.
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