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

Add all fixes for search functionality from upstream #286

Merged
merged 14 commits into from
Dec 28, 2020

Conversation

hawkeye116477
Copy link
Contributor

Code is almost original, only changes made by me are on 92f7e4d.

gorhill and others added 14 commits December 21, 2020 11:48
Reported internally.

Potential regex flags are passed as is to RegExp contructor,
and in case of failure the query is deemed a plain text one.

Related commit:
- codemirror/codemirror5@8de67d2#diff-3f4aa453cefa49f6431f1bba3bb53a8e
Also eat backslash for `\\`, to allow searching for
literal `\n`, `\t`.
Related issue:
- uBlockOrigin/uBlock-issues#768

So that the input fields can gain extra built-in
browser widgets useful in search fields.

(For now only on Chromium)
Before this commit, CodeMirror's add-on for search occurrences
was limited to find at most 1000 first occurrences, because of
performance considerations.

This commit removes this low limit by having the search
occurrences done in a dedicated worker. The limit is now
time-based, and highly unlikely to ever be hit under normal
condition.

With this change, all search occurrences are gathered,
and as a result:

- All occurrences are reported in the scrollbar instead of
just the 1,000 first

- The total count of all occurrences is now reported, instead
of capping at "1000+".

- The current occurrence rank at the cursor or selection
position is now reported -- this was not possible to report
this before.

The number of occurrences is line-based, it's not useful to
report finer-grained occurences in uBO.
Related commit:
- gorhill/uBlock@2333240

Since the search worker can go away after its time-to-live
elapsed, we may need to pass again the haystack on which
search operations are performed.
Code review following latest changes.

Also, move the input field to the left so that it
renders properly on smaller displays and does not
jump around when the result position/count numbers
change.

This also makes it easier to add more functionality
to the editor's toolbar in the future.
Added a dotted box around found text occurrences,
as just pale yellow to highlight the text is not
enough to visually distinguish from surrounding text.

Iterating through found text occurrences will now
ensure they are vertically positioned in the middle
of the editor.
@JustOff
Copy link
Collaborator

JustOff commented Dec 21, 2020

Here is the beta version to test: uBlock0_1.16.4.28b1.firefox-legacy.xpi.zip (rename to xpi to install).

@JustOff JustOff merged commit 05d14d3 into gorhill:master Dec 28, 2020
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.

3 participants