[Geany-Devel] pull request on GitHub, to add GeanyHighlightSelectedWords, into Geany Plugins

marius buzea magnetudinbuda at xxxxx
Fri May 29 10:44:37 UTC 2015


With KMP it is possible to search all occurrences of a m length string, into a n length string,
using O(m+n) machine operations.    Next page:
describes the algorithm.

The KMP works well with the utf-8 encoding of unicode.    One property of utf8 is that
the encoding one unicode symbol is not a substring of another utf8 substring.      This
property allows to take the utf-8 encoding of the string you wish to search, and to
find this utf8 encoding string, in the utf8 encoding of the text string.       Geany uses
scintilla, and scintilla uses utf8 to encode the document it displays, and scintilla has
a command that gives the raw utf8 byte array for a [start, end) range.      So, KMP
gives great speed for searching all occurrences, and may be used with the underlying
text representation of scintilla used by geany.     The utf-8 encoding of a unicode
string of length n, is less than 6n, each utf8 encoding is at most 6 bytes.

I also think that including this functionality/feature into Geany core would be a good choice.
It would be a small tradeoff between keeping the core small, and adding this new functionality,
but this is your choice.

If you wish to extend automark, then this is good choice too.   If you wish, and if it helps,
please reuse any part of the implementation provided here:
If needed, I would help.

What should I do next?     Should I not do the pull request for GeanyHighlightSelectedWord?
It is okay with me.    GeanyHighlightSelectedWord would then be still available at sourceforge until
Geany provides this functionality from its core, or from automark.

Have a great day,
Marius Ioan Buzea

On Fri, 5/29/15, Thomas Martitz <kugel at rockbox.org> wrote:

 Subject: Re: [Geany-Devel] pull request on GitHub, to add GeanyHighlightSelectedWords, into Geany Plugins
 To: devel at lists.geany.org
 Date: Friday, May 29, 2015, 10:03 AM
 Am 29.05.2015 um 00:10
 schrieb marius buzea:
 > Hello,
 > I had a look at
 > This plugin does
 something similar to GeanyHighlightSelectedWord.
 > The quick-search.c
 calls Geany's search_find_text several times in one
 > processing, and each time a regex would be
 recompiled in search_find_text.
 > This
 is, I guess, a small cost when the regex is just a
 GeanyHighlightSelectedWord implements search using KMP.
 > Designs differ, but
 functionality is alike.  I would keep both this plugins,
 > and not try to merge them.
 Can you
 describe this KMP algorithm, and why it should be
 Anyway, the
 existing plugin (automark) should look into adopting it (if
 it is indeed an improvment) instead of
 having multiple plugins with the 
 PS: I also
 agree with providing it by the core.
 Best regards
 Devel mailing list
 Devel at lists.geany.org

More information about the Devel mailing list