Highlight fails on neighbouring words
Siguza opened this issue · comments
Version info
$ atom --version
Atom : 1.38.2
Electron: 2.0.18
Chrome : 61.0.3163.100
Node : 8.9.3
$ apm list | grep lint
$
(Yeah, I have no package containing lint
in its name installed - should I?)
Issue
When the word that is supposed to be highlighted appears twice with only a single character in between, only one of them is highlighted:
Test file:
00000000 00000000 00000000
00000000.00000000.00000000
00000000-00000000-00000000
00000000 00000000 00000000
00000000..00000000..00000000
00000000--00000000--00000000
I often sift through hexdumps, so I definitely have a use case for this.
From glancing through the code, it would seem to me that changing nonWordCharacters
in search-model.js to be embedded in lookbehind and lookahead groups rather than non-capturing groups might fix the issue, but I neither have a build setup to test this, nor did I want to create a pull request without actually understanding the codebase.
Thanks for this.
I added a lookahead to the second part see this pull request: https://github.com/richrace/highlight-selected/pull/202/files
Can play with it here: Regex with a lookahead
I can't remember why I had the apm list | grep lint
command in the contributing guide. So I've opened #203 as it is a bit out of date. Thanks for following it though.
I can confirm this bug. Is there any fix planned?
This comment #201 (comment)
Links to a PR and an interactive JS regex console. Was looking to see if those changes fix it as I haven’t come across it.
This comment #201 (comment)
Links to a PR and an interactive JS regex console. Was looking to see if those changes fix it as I haven’t come across it.
Okay, I've applied proposed PR and tested it on my local machine. Seems to work just fine now:
I guess it can be merged into master for new version to have this bug fixed ;)
P.S. Thanks for such a lightweight and useful plugin.
Thanks for confirming!