At the moment tags with identical names are stored into a linked list in
tags_table and parents_table. This however leads to quadratic complexity
when looking up the nearest parent or tag in tree because the whole list
has to be traversed.
Use binary trees indexed by line number instead of lists so the lookup can
be performed in log(N) time and the overall complexity is N*log(N) instead
of N^2.
The GTree API is a little stupid because during the search it doesn't give
access to the value and it doesn't tell when a leaf node was reached. For
this reason the lookup has to be made in two steps - first, the best line
number is found (returned in user_data) and then a normal search for the
found line number is made to get the value stored in the tree.
This patch fixes the problem described in #577 when e.g. a big json export
file contains many identically named tags.
Take a copy of the strings not to require them to live live as long as
the plugin does.
This is mostly useful for plugins implemented in dynamic languages
(e.g. through a plugin proxy), as most C plugins will use a static
string here; but it makes the API more straightforward and avoids odd
issues if any plugin doesn't use static strings here, even C ones.
Closes#1125.
If possible, register signals with the proper argument types (boxed or gobject).
This is required for successful introspection of the signals and important
for GI-based plugins.
As for the marshallers, if available use a predefined one from glib. Otherwise
use the generic marshaller available since 2.30 (in theory all signals could
use that one but it has a bit of overhead).
This builds on the gboxed conversions of earlier commits.
This also bumps the minimum glib requirement.
- g_cclosure_marshal_generic requires 2.30 (if NULL is passed as marshaller
to g_signal_new())
- G_TYPE_KEYFILE requires 2.32
At the moment undo of line end type change only undos the changes made
in the document but the different line ending settings remains active.
This patch fixes the issue by combining the line end scintilla undo action
with a new UNDO_EOL action responsible for updating the line ending
settings.
Fixes#409
geanyobject can be used by plugins to connect to plugin signals directly
(required for GI-based plugins). Access through GeanyData::object. The related
doxygen comments are @gironly for now, since plugin_signal_connect() is still
preferred.
Finally, the useless function pointer prototypes are removed from the
GeanyObjectClass structure as they became useless (they have been unused and
generally wrong since ever).
Even when we know when should be searching for definition (or declaration),
we can keep searching for the opposite type too when we didn't find
anything with the "correct" def/decl type. So at least we find "something"
of that name.
To detect the change of typename list since the last time the colourisation
happened, we could store the complete typename string used during the
last colourization and compare it with the current string. For lots of
typenames this might be quite a huge string stored for every opened tab
(well, it's also stored in Scintilla already for every document but better
not to have it twice). Instead, we can store an uint hash of the string.
We could also use a better hash function with longer hash value but
uint size should be enough for this case (and in the case of a collision
nothing terrible happens).
Properly handle discarding the dialog asking whether to override a
keybinding as canceling it rather than as allowing multiple identical
keybindings.
In the way, simplify and fix dialogs_show_prompt() not to perform odd
and useless response mapping that effectively go round back, and that
don't handle what the comment above it suggests. Simply document it
can return GTK_RESPONSE_DELETE_EVENT and handle it in the caller side,
as it's a possibly valuable information. Only one current caller is
affected, and it doesn't change anything as it doesn't change behavior
but only documents it.
Closes#714.
Make each convenience library depend on the ones it requires, which is
pretty straightforward for us as they each only depend on a single
other one, avoiding any worry about double linking of static objects.
GTK 3.20 doesn't like getting a style property for a non-current state,
unless the call is wrapped in a save()/restore() pair.
So, fix the code to either use the current state or temporarily save
the context.
gb.c now uses different states, but it shouldn't really matter given
how they are used, and even gives a native behavior when the window
loses focus, as it now properly reacts to BACKDROP state.
Normally menu items are updated only when adding or removing
them on osx. They are however not redrawn when just changing
keybindings so the old keybinding is displayed after the change.
Force the menu update to show the updated keybindings.
The Doxygen comments were on the non-public global filetypes_array and
filetypes_by_title variables instead of the GeanyData members which are
exposed to the plugin API and reference manual.
The global was never accessible to plugins on Windows and hasn't been
accessible to plugins on Linux and others since the linkage-cleanup
changes.
Move documentation from the global variable to the GeanyData member
of the same name.
Closes#964