-
Notifications
You must be signed in to change notification settings - Fork 149
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
Fix bad boundary matches #188
Conversation
1 similar comment
dumb-jump.el
Outdated
|
||
(:type "variable" :supports ("ag" "grep" "rg" "git-grep") :language "elisp" | ||
:regex "\\\(setq\\b\\s*JJJ\\j" :tests ("(setq test 123)") :not ("setq test-blah 123)")) | ||
:regex "\\\(setq\\b\\s*JJJ\\j" :tests ("(setq test 123)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like in the other places, it would be nice with a newline before :tests
for readability.
@@ -125,25 +125,25 @@ or most optimal searcher." | |||
:type 'string) | |||
|
|||
(defcustom dumb-jump-ag-word-boundary | |||
"(?![\\w\\?\\*-])" | |||
"(?![a-zA-Z0-9\\?\\*-])" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The motivation for using a-zA-Z0-9
instead of \w
is that you don't want it to match for _
which is the only other character not matched by this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some searchers it was causing bad matches as outlined in #186 . For example, saying tester
was a match when jumping on test
. You can see evidence of this in the early commits for this PR with the ❌s, but here's a deep link to one example: https://travis-ci.org/jacktasia/dumb-jump/jobs/316563561
Thanks again for looking at this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This leads me to believe for these searchers with the options we give them \w
is not recognized at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very weird but I see the point. Np :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I only have that thing about the substitution of \w
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve of these changes. You'll squash?
@netromdk Yup, thanks! |
#186