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

filter editor search enhancements #493

Closed
filbo opened this issue Mar 29, 2019 · 8 comments
Closed

filter editor search enhancements #493

filbo opened this issue Mar 29, 2019 · 8 comments
Labels
enhancement New feature or request fixed issue has been addressed

Comments

@filbo
Copy link

filbo commented Mar 29, 2019

Hi,

(mistakenly posted this as uBlockOrigin/uAssets#5241, sorry...)

Within uBO options, when looking at / editing a specific filter list, I was looking for filter lines which would affect github.io. I searched for github and was dismayed to see '1000+' hits in the main 'uBlock filters' list.

Now, there is a trivial workaround for my use case (actually enter github.io); but suppose I were truly looking for an issue with github.com? The 1000+ mentions of https://github.com/uBlockOrigin/uAssets/issues/%d would block me completely.

... which led me to wish for two (and a half) things:

  1. search-within-list which is comment-sensitive; that is, ignore lines which are comments
    a. suboption which includes comments which are valid rule syntax, ignoring only human-readable comments; obviously, not the default...

  2. search-within-list which is domain-sensitive; that is, find rules which match the given domain or domain-wildcard. This would do wildcard matching in both directions: I enter github.io, it matches rules looking for github.io and github.*; I enter github.*, it matches both of those + github.com. Possibly 'domain' is the wrong concept; searching for *.github.io/*.css ought to be able to match rules with that specificity.

The UI could look something like:
uBO-filter-search

@filbo
Copy link
Author

filbo commented Mar 29, 2019

Or possibly like this (except probably a pulldown menu rather than radio buttons):
uBO-filter-search2

@uBlock-user
Copy link
Contributor

You mean to suggest "Don't count results from commented lines" right ?

@uBlock-user uBlock-user added the enhancement New feature or request label Mar 29, 2019
@gwarser
Copy link

gwarser commented Mar 29, 2019

This field supports regex (/.../), assertions should work, but they don't :(

[e: Meh, lookbehind assertions still not implemented]

Maybe because multiline is enabled by default?

/^[^!\n][^\n]+github/ ???

@filbo
Copy link
Author

filbo commented Mar 30, 2019

I mean to suggest multiple things.

Sometimes a comment is exactly what I'm looking for. Other times it's something about a rule. Therefore, it would be helpful to have a control in the widget, telling it whether or not to consider comments.

Then I additionally thought of a sub-control which would have it search rules + commented-out rules, but not 'real' comments. This would search all rule lines, plus all commented-out lines which parse successfully as rules. I particularly imagine using this when I had commented out some rule, thinking it was no longer needed, then realized it was still needed. The likely search string I remember for that rule is something that would hit in a lot of 'real' comments, so omitting those would help.

...

and, domain match would help quickly ask a particular list: which of these rules apply to this site I am scrutinizing right now?

@gorhill
Copy link
Member

gorhill commented Mar 30, 2019

So far, what I am reading is a request to add a lot of effort, code, development time and future maintenance for "what if I want to search for github.com". @gwarser provided a solution for this one case.

@gorhill
Copy link
Member

gorhill commented Mar 31, 2019

Maybe because multiline is enabled by default?

/^[^!\n][^\n]+github/ ???

Yes, I switched multiline to false here, and that fixes the search. However, there seem to be a CodeMirror bug, because after this, the search itself works as expected, but the scrollbar annotations are still reporting 1000+ hits. I created a fix locally, I will have to create a pull request to CodeMirror.

@gwarser
Copy link

gwarser commented Mar 31, 2019

@gorhill, if you are looking at CodeMirror regex, maybe you will also take a look at this codemirror/codemirror5#5428

gorhill added a commit to gorhill/uBlock that referenced this issue Apr 23, 2019
@gorhill
Copy link
Member

gorhill commented Apr 26, 2019

I consider the issue addressed here with commit gorhill/uBlock@72bbcdd. That commit prevent multiline matches when using a regular expression. Using a regular expression is the way to address fancy search behavior -- I decline to work on modifying the current UI as suggested.

Before the fix: /^[^!\n][^\n]+github/
After the fix: /^[^!].+github/

@gorhill gorhill closed this as completed Apr 26, 2019
@uBlock-user uBlock-user added the fixed issue has been addressed label Apr 26, 2019
hawkeye116477 pushed a commit to hawkeye116477/uBlock-for-firefox-legacy that referenced this issue Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed issue has been addressed
Projects
None yet
Development

No branches or pull requests

4 participants