sieukrem / jn-npp-plugin

Plugin for Notepad++ allowing you to automate some tasks using JavaScript
https://github.com/sieukrem/jn-npp-plugin/wiki
110 stars 24 forks source link

SmartHighlight.js does not highlight all occurrences #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Install jN 2.0.116
2.Double click on a word

What is the expected output? What do you see instead?
Highlight all occurrences of the selected word, even if part of a longer word, 
like the screenshot. The screenshot is from another PC with Win 7 64bit, 
Notepad++ 5.9.6.2, jN unknown version.

What version of the product are you using? On what operating system?
Win 7 64bit, Notepad++ 6.5.3, jN 2.0.116

Original issue reported on code.google.com by obakasa...@gmail.com on 15 Jan 2014 at 9:00

Attachments:

GoogleCodeExporter commented 9 years ago
I attached version with debug popups. Please replace smarthighlight.js with it 
and restart Npp

You should see:
1. Popup with "1" at start
2. Popups "5","6","7" after doubleclick on some word
3. Popups "3","4","3","4" after click else where without selection

What language has your UI of Npp?

Original comment by eugen.kr...@gmail.com on 15 Jan 2014 at 9:23

Attachments:

GoogleCodeExporter commented 9 years ago
I got the popups as you described.
The UI of my Npp is English.

Original comment by obakasa...@gmail.com on 15 Jan 2014 at 10:00

GoogleCodeExporter commented 9 years ago
Try text styling I do in article 
http://code.google.com/p/jn-npp-plugin/wiki/SmartHighlighter

I think it is either timing problem or some of style does not work.

Original comment by eugen.kr...@gmail.com on 16 Jan 2014 at 7:41

GoogleCodeExporter commented 9 years ago
That did not work either:
- I reverted the SmartHighlighter.js to the version in 2.0.116
- I typed the three lines of text, then double-click selected "TGG" on line3, 
and right-click on it -> "Style token" -> "Using 3rd Style"
- The script highlights the "TGG" on line5, but not the one in line1.

Original comment by obakasa...@gmail.com on 16 Jan 2014 at 8:04

Attachments:

GoogleCodeExporter commented 9 years ago
Interestingly though, it works when I do this (see screenshot):
- select "TGG" on line1
- right click -> style token -> using 1st style
- the script highlights all occurrences, including line7!!

Original comment by obakasa...@gmail.com on 16 Jan 2014 at 8:18

Attachments:

GoogleCodeExporter commented 9 years ago
Is navigation bar visible close to scroll bar?

Original comment by eugen.kr...@gmail.com on 16 Jan 2014 at 8:41

Attachments:

GoogleCodeExporter commented 9 years ago
I have reproduced behaviour you described in #5 and #4. It is a Notepad++ issue 
and not jN.

Is that a content of this issue? That not ALL of occurences are highlighted. My 
misstake it is in title of issue. :-(

Then yes, you should open an issue here 
http://sourceforge.net/p/notepad-plus/bugs/

Original comment by eugen.kr...@gmail.com on 16 Jan 2014 at 9:00

GoogleCodeExporter commented 9 years ago
The NavigationBar is visible.

===

You may be right, that this is a NPP issue, but I'm not sure.

The behavior I'm trying to achieve is produced by the SmartHighlighter.js 
script, I think. This is shown in the screenshot, which was on my older PC 
(Win7 64bit, English NPP 5.9.6.2 with jN (not sure which version)). The two 
scenarios are identical except for whether the SmartHighlighter.js was placed 
in the "plugins/jN/includes/disabled" folder or not. The behavior I want is the 
one on the right.

Original comment by obakasa...@gmail.com on 16 Jan 2014 at 9:18

Attachments:

GoogleCodeExporter commented 9 years ago
Yes, it is Notepad++ issue/feature change. SmartHighlighter uses the styling 
feature of Notepad++. It catches doubleclick event and calls Notepad++ menu 
handler, that colours all occurences (Search/Mark All/Using 5th Style).

I would accept it as jN issue if on doubleclick only one occurence were 
selected or all occurences selected but navigation bar is missed.

Original comment by eugen.kr...@gmail.com on 16 Jan 2014 at 9:29

GoogleCodeExporter commented 9 years ago
Ok, I understand. Thank you!

Do you think it is possible to get around this somehow, by modifying the 
SmartHighlighter.js script?

Original comment by obakasa...@gmail.com on 16 Jan 2014 at 9:48

GoogleCodeExporter commented 9 years ago
I just found out that the "Find (ctrl+F)" "Mark" tab has:
- "Match whole word only" grayed out in v5.9.6.2
- "Match whole word only" possible to enable/disable in v6.5.3

Is it possible for your script to call Mark All with "Match whole word only" 
disabled?

Original comment by obakasa...@gmail.com on 16 Jan 2014 at 9:54

GoogleCodeExporter commented 9 years ago
I think it is possible
1. One should write a script that use a regular expression to find all 
necessary positions
2. Using API of Scintilla mark positions 
http://www.scintilla.org/ScintillaDoc.html

Original comment by eugen.kr...@gmail.com on 16 Jan 2014 at 9:55

GoogleCodeExporter commented 9 years ago
> Is it possible for your script to call Mark All with "Match whole word only" 
disabled?

No, it is not possible. jN can call only menu entries.

Original comment by eugen.kr...@gmail.com on 16 Jan 2014 at 9:57

GoogleCodeExporter commented 9 years ago
I figured it out!

In v6.5.3, whether the Search->Mark all matches whole words only or not, is 
determined by the checkbox option in the Find dialog. (Ctrl+F -> "Mark" tab -> 
"Mark whole words only".

To get the behavior I want described in #8, just uncheck that option.

===

Thanks for the jN plugin and the smart highlighter script!!

Original comment by obakasa...@gmail.com on 16 Jan 2014 at 10:00

GoogleCodeExporter commented 9 years ago
;)

Original comment by eugen.kr...@gmail.com on 17 Jan 2014 at 7:39