Highligh all similar word in Document to selection

72 views
Skip to first unread message

HHT

unread,
Jun 14, 2012, 8:27:55 AM6/14/12
to scintilla-interest
Hi,
I need to highlight/un-highlight all words in the document similar to
current selection. Does scintilla support that?
If it supports I will appreciate pointer to right direction. Docs as
well as google have been of no help to me this time but then I may be
missing something right there :)
TIA,
Stefano

Nicholai Benalal

unread,
Jun 14, 2012, 9:22:54 AM6/14/12
to scintilla...@googlegroups.com, scintilla-interest
Hi,

I don't think there's any direct support for this in scintilla so you would have to implement it yourself in the editor. That's what we do in the Scribble editor for MorphOS at least.

Best,

Nicholai
> --
> You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
> To post to this group, send email to scintilla...@googlegroups.com.
> To unsubscribe from this group, send email to scintilla-inter...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/scintilla-interest?hl=en.
>

tenaja

unread,
Jun 14, 2012, 9:44:20 AM6/14/12
to scintilla...@googlegroups.com
I just went through this recently. There are two Lua examples that I found helpful; search for markOccurrences.lua and highlighting_identical_text.lua .
These are the basic steps:
  • Get the selected text.
  • Search for an occurance. It is up to you to decide screen-view or full doc. Delays may be noticeable with long docs, if you do the whole thing. Use RegEx if you need "similar" words, and not exact matches.
  • Mark the find with an Indicator, using SCI_INDICATORFILLRANGE. Rinse and Repeat.
  • To unmark them, use SCI_INDICATORCLEARRANGE
Have fun!

Philippe Lhoste

unread,
Jun 14, 2012, 10:47:45 AM6/14/12
to scintilla...@googlegroups.com
SciTE can do that now. The property enabling that is highlight.current.word
You can locate how it is done by searching the source of SciTE around this property...

--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --

HHT

unread,
Jun 14, 2012, 3:38:27 PM6/14/12
to scintilla-interest
Thank you all for your help.
I will go thru your suggestions and work out a solution!
Reply all
Reply to author
Forward
0 new messages