Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Instantly update live search#1046

Open
joliss wants to merge 1 commit intoatom:master from
joliss:instant-live-search
Open

Instantly update live search #1046
joliss wants to merge 1 commit intoatom:master from
joliss:instant-live-search

Conversation

@joliss
Copy link

@joliss joliss commented Aug 17, 2018
edited
Loading

Description of the Change

This change causes find-and-replace to react instantly to keystrokes in the findEditor (the "Find in current buffer" field), rather than after a 300ms debounce delay.

This is especially important when the scrollToResultOnLiveSearch setting is enabled, as it lets you instantly see when you're at the right place in the file, just like when you search a web page in Chrome.

Alternate Designs

One could make this behavior changeable with a setting. But I'm not sure if that's even necessary.

Benefits

Search feels snappier.

Possible Drawbacks

I haven't tested the performance impact of this with large buffers or on slower CPUs. We wouldn't want the editor to become unresponsive as you type into the search field.

Applicable Issues

When I tried running the test suite I had some failing tests on master, so I'm not sure if this broke any tests.

This change causes find-and-replace to react instantly to keystrokes in
the `findEditor` (the "Find in current buffer" field), rather than after
a 300ms debounce delay.
@joliss joliss changed the title (削除) Instantly update live search. (削除ここまで) (追記) Instantly update live search (追記ここまで) Aug 17, 2018
Copy link
Contributor

Aerijo commented Aug 18, 2018
edited
Loading

Instant update feels good, but it makes typing noticably slower with many matches (e.g., 20 000). I think work needs to be put into handling the many matches case first, before this can be merged.

Alternatively:

  • There could be a mechanism to switch between delay and no delay, based on number of matches

  • A custom delay time could be used, so it's faster than onDidStopChanging, which is used for more than just find and replace, but slow enough to let the user type.

Copy link
Contributor

I think that what we ultimately need to do is a two-step process:

  • In an onDidChange callback, search the visible area. If there are no visible results after the cursor, find the next visible result for the purpose of supporting scrollToResultOnLiveSearch.
  • Then, in an onDidStopChanging callback, search the entire buffer, in order to compute the result count and the Result n of m message.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Comments

AltStyle によって変換されたページ (->オリジナル) /