Finding the current function now better handles the case the current
line is after a function but outside its scope, and many other issues
the scope reporting had.
The code assumed that if both old and new fold levels were above the
minimal function fold level the function couldn't have been changed,
which is wrong if a function can appear both inside and outside another
fold level (e.g. inside or outside a class).
This makes symbols_get_current_function() more accurate by using TM
data even on a modified file if realtime tag parsing is enabled, thus
if the data has reasonable chances to be correct.
On GNU X86-64 systems the predefined macros are required
to choose the correct headers, so tag definition fails with
-undef. Removed it from hardcoded, systems that need it can
add it to CFLAGS.
Most noteworthy change is that all build commands IDs and groups are
now unsigned everywhere negative values aren't explicitly handled with
a special meaning. This should not change anything in behavior, only
makes clear the index won't underflow.
Old implementation was not really fitting the updating needs and had a
bug making symbols disappear if they haven't changed but their parent
did (e.g. when a C++ constructor's signature changed).
New implementation does:
1) walk old tree, updating or removing rows;
2) add remaining tags.
It walks less than (new_tags + old_tags + new_tags) in the worst case,
thanks to some hash table-based caching; and also gets rid of the
"valid" column in the symbols tree, saving a few bytes in memory.
Finally, there is a ~7% performance gain (from 21 to 18ms) upon common
tree updates, sometimes more.
* Processed with rstrip-whitespace.py script added to scripts/ directory.
* Script run on all .c and .h files in src/ and plugins/ directories.
* Also remove more than one newline at the end of files.
When searching for an old entry to reuse when updating an existing
symbol list, take into account the symbol's argument list not to
always match the same entry for overloaded symbols.
Closes#3406644.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5910 ea778897-0a13-0410-b9d1-a72fbfd435f5
When creating temporary files for generating global tag files, use
the system directory for temporary files rather than the configuration
directory, so it works even if the configuration directory doesn't
already exist.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5890 ea778897-0a13-0410-b9d1-a72fbfd435f5
This is for better performances since appending to a list means walking
it to find the last element to append to. When the list ordering
matters, simply reverse the list after prepengins.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5586 ea778897-0a13-0410-b9d1-a72fbfd435f5
This avoids wrong sorting, and then wrong display in the symbols list,
if a parent tag is on the same line than its children, and one of it's
children would be sorted before alphabetically (closes#3193982).
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5580 ea778897-0a13-0410-b9d1-a72fbfd435f5
Rather than walking the whole tree for each tag to find a possibly
corresponding row, use a hash table as cache.
This is a very significant improvement on large files with many tags,
reducing for example to about 170ms an update that took more than 18s
before.
Also fix merging of tags with same name and scope (probably unlikely to
exist in real-world files, but the tagmanager extract them correctly
and they used to display correctly too).
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5567 ea778897-0a13-0410-b9d1-a72fbfd435f5
The main advantages of not clearing and rebuilding the whole list is
that it doesn't loose the folding and selection (as far as the selected
row(s) still exist after the update, of course), and it reduces
flickering upon update.
The current implementation works in 3-steps:
1) mark all rows as invalid;
2) insert/update the rows, according to the new tag list, marking them
as valid;
3) remove all rows that are still invalid.
This walks (rows) the first time, (tags*rows) the second and (rows) the
third. This also uses an extra column to store the row's validity.
A (probably) better implementation would be to:
1) walk the current rows, updating them if necessary, or removing them;
2) add the remaining tags that weren't there before.
This is probably faster in theory (and probably also in practice), but
it needs to refactor a lot the code to easily update *or* create a row,
what the current code does not provide.
Basically this is would be a two-pass update, walking (rows*tags) in
the first pass, and only the remaining non-added tags in the second.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5562 ea778897-0a13-0410-b9d1-a72fbfd435f5
It is a boxed type but uses reference counting behind the scene. This
allow for example the tag store to make sure the tags it holds are
always valid.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5560 ea778897-0a13-0410-b9d1-a72fbfd435f5
Definition look for a tag declaration instead, as this is more
useful. Likewise make Go to Tag Declaration search for a tag
definition in this case also.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5428 ea778897-0a13-0410-b9d1-a72fbfd435f5