Closed Bug 1634100 Opened 5 years ago Closed 5 years ago

Search for substring menu includes char before "word"

Categories

(Webtools :: Searchfox, defect)

defect

Tracking

(Not tracked)

RESOLVED FIXED

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.

(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.

Good catch, thanks for tracking down the code in question!

PR for fix: https://github.com/mozsearch/mozsearch/pull/313

Assignee: nobody → kats

I applied the fix to the currently running webserver too, so if you shift+reload it should be fixed.

Looks good on shift+reload, thanks!

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED

oops, I had second thoughts about resolving this myself, sorry for the noise

Status: RESOLVED → REOPENED
Resolution: FIXED → ---

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.

Status: REOPENED → RESOLVED
Closed: 5 years ago5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.