Search for substring menu includes char before "word"
Categories
(Webtools :: Searchfox, defect)
Tracking
(Not tracked)
People
(Reporter: agashlin, Assigned: kats)
Details
(Keywords: regression)
When clicking on a word not otherwise recognized as a symbol, the non-word character (whitespace or punctuation) before the word is included in the popup "Search for the substring", and will be included in the search if that option is selected.
An example, click MOZ_RESET_PROFILE_RESTART
.
I think this is a regression as I use this functionality pretty heavily and only noticed it today. It think it was caused by this commit, this loop stops searching backwards when it finds a non-word char, but start
is left pointing there (or possibly at -1). start += 1
would likely fix this.
Reporter | ||
Comment 1•5 years ago
|
||
(or possibly at -1). start += 1 would likely fix this.
Er, no, the loop condition is start > 0 && isWordChar(string[start])
, so it does stop at start == 0
. Perhaps it should be start > 0 && isWordChar(string[start-1])
, then.
Assignee | ||
Comment 2•5 years ago
|
||
Good catch, thanks for tracking down the code in question!
PR for fix: https://github.com/mozsearch/mozsearch/pull/313
Assignee | ||
Comment 3•5 years ago
|
||
I applied the fix to the currently running webserver too, so if you shift+reload it should be fixed.
Reporter | ||
Comment 4•5 years ago
|
||
Looks good on shift+reload, thanks!
Reporter | ||
Comment 5•5 years ago
|
||
oops, I had second thoughts about resolving this myself, sorry for the noise
Assignee | ||
Comment 6•5 years ago
|
||
No worries. We usually close bugs against searchfox after the PR is merged and deployed. PR is merged now and the fix will be deployed tomorrow, but is also applied manually against the current server so we can just close it.
Description
•