[Geany-Devel] pull request on GitHub, to add GeanyHighlightSelectedWords, into Geany Plugins
Jiří Techet
techet at xxxxx
Fri May 29 21:03:10 UTC 2015
On Fri, May 29, 2015 at 1:25 AM, Matthew Brush <mbrush at codebrainz.ca> wrote:
>
> Ideally you could improve the underlying implementation of an existing one
> if your way is better[0] and they perform the same function. It's really
> confusing for users to figure out what is the "right" plugin when there's
> too many doing the same thing. The same thing happens with GeanyGDB,
> Debugger, and Scope right now.
>
> That being said, showing occurrences of the word is such a common and
> fairly useful feature for an IDE, I'd personally rather see the 3-4
> existing plugins obsoleted by a good implementation in core Geany[1].
>
> Cheers,
> Matthew Brush
>
>
+1 on having it directly in Geany.
And IMO, the simplest possible implementation should be used - i.e. using
just strstr() for finding the names and highlighting the whole editor and
not just the visible part and redoing this when scrolling.
KMP is quite an overkill in this case - it would be useful only if
1. The text to locate would be long (which isn't the case because
function/variable names are quite short)
2. The searched text would contain many prefixes from the text to locate
(again not the case - variables/functions can have common prefix but
typically there will be at most one per line and not like every second
character). Most of the time strstr() will find different characters at the
first position and advance to the next character.
If you consider what we are doing when the document changes - i.e. parsing
the document twice, once by scintilla lexer, once by ctags parser - and
this happens on the main thread and nobody notices it, then the search part
in the highlighting will be almost for free.
Cheers,
Jiri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20150529/40d2a803/attachment.html>
More information about the Devel
mailing list