python script: additional chars and smarthighlight
- 
 Hi, I’m using python script plugin and it works quite well for my basic usage. What I want to do, is to highlight word/string with the mouse double click and use smart highlighter to colorize all the same words/strings in text on the same tab. As I’m using additional chars and this script, smart highlighter doesn’t work for words with additional chars: def extendWordChar(): 
 additionalChars = ‘:._-’
 chars = editor.getWordChars()
 if additionalChars not in chars:
 editor.setWordChars(chars + additionalChars)def callback_READY(args): 
 extendWordChar()def callback_BUFFERACTIVATED(args): 
 extendWordChar()notepad.clearCallbacks([NOTIFICATION.BUFFERACTIVATED ]) 
 notepad.callback(callback_BUFFERACTIVATED, [NOTIFICATION.BUFFERACTIVATED ])
 notepad.callback(callback_READY, [NOTIFICATION.READY ])thx in advance 
- 
 I find that if I execute the following code, then double-clicking anywhere in the comment line smart-highlights everything between the first ‘a’ and the final ‘e’…so it appears to work for me: new_word_chars = '-:.' for c in new_word_chars: if c not in editor.getWordChars(): editor.setWordChars(editor.getWordChars() + c) # abc-def-ghi.aaaa:eeeee
- 
 Hi Scott, Script that I’m using and your script highlights word/string. But notepad++'s feature “smart highlighter” highlights (green color by default) all the same words/strings in current tab. And it doesn’t work for words/strings with my additional chars. 
 So I need to force it somehow via python script I guess.
- 
 hello @Gytis-Mikuciunas 
 have you try the function “Search”/“mark all”/“using 1st style” (or other style) or through the contextual menu “style token”/“using 1st style” (could be map to a shortcut)
 It’s highlight whatever you want including your extended word chars
- 
 This is not a solution for me to use shortcuts etc. If it’s working by default why I need to do manual searching, marking. 
 very handy when you double-click on some word or string and can see immediately if it repeats somewhere.I hope that Claudia Frank will look into my posts :) She always has good script related ideas and solutions :) 
- 
 You can mention Claudi Franck directly so that he’ll get a notification 
 @Claudia-Frank
- 
 Adding more copies of the pseudo-word from my little test script to the editor window and then getting the smart highlighter to invoke…turns bright green ALL copies of the same pseudo-word string. I seem to recall some problem/issue with setting the word characters with an earlier version of N++; I think it was @dail that pointed this out to me in a posting that I can’t find at the moment. I’m currently running N++ 7.1 x86 and this type of word-character change in combination with the Smart Highlighting works there. 
- 
 I found the posting I mentioned: https://notepad-plus-plus.org/community/topic/12186/select-variables-with-dollar-sign-in-php-scripts @dail indicated there that the version must be > 6.8.3 
 As that is quite old, I’ll presume that you are running something newer and that there is some other reason for your trouble…I just don’t know what it is.
- 
 Scott, you’re right. 
 I have updated my noteped++ to the newest version and now it works as expected.thx a lot!!! 


