[Geany-devel] New "populate-edit-menu" plugin signal
enrico.troeger at xxxxx
Sat Jun 28 15:58:38 UTC 2008
I just added a new signal for plugins: "populate-edit-menu".
The intended use is to modify or extend the editing menu (right-click
popup menu) before it is shown. The current word under the cursor, the
cursor position and a reference to the current document is passed to the
signal handler. So plugins have many information to perform some
actions. Usage example: I added this signal for the spellcheck plugin
where a "Spellcheck" menu item is added to the edit menu when the
cursor is above a misspelled word to provide a sub menu with
The more important thing is while adding the new code, I noticed the
function editor_find_current_word() wasn't Unicde-safe, this means when
the cursor is above a word containing Unicode characters (i.e. any
non-Ascii characters) the resulting string is wrong.
For Goto tag definition/declaration this isn't a big problem as these
are mainly plain Ascii. But it is also used e.g. for the Find dialogs
when the current word below the cursor is used as search word. This
badly fails with the old code.
So, I tried to fix it by explicitly allowing non-Ascii characters
which seems to work (SVN r2732).
I'm still not very happy with the current code. It allows also any
punctuation characters defined in Unicode. This is probably only a
small issue at least I don't think such are used widely.
A possible clean solution could be to read g_unichar's when searching
the word boundaries and check each g_unichar against the passed
wordchars and with e.g. g_unichar_isalnum().
But this still needs to be implemented. If anyone feels to do it,
patches are welcome :).
Get my GPG key from http://www.uvena.de/pub.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: not available
More information about the Devel