Revision: 1254 http://svn.sourceforge.net/geany/?rev=1254&view=rev Author: ntrel Date: 2007-02-07 04:44:37 -0800 (Wed, 07 Feb 2007)
Log Message: ----------- Fixed autocompletion missing tag matches.
Modified Paths: -------------- branches/geany-0.10.1/NEWS branches/geany-0.10.1/tagmanager/include/tm_tag.h branches/geany-0.10.1/tagmanager/tm_tag.c
Modified: branches/geany-0.10.1/NEWS =================================================================== --- branches/geany-0.10.1/NEWS 2007-02-07 12:28:09 UTC (rev 1253) +++ branches/geany-0.10.1/NEWS 2007-02-07 12:44:37 UTC (rev 1254) @@ -3,8 +3,9 @@ Bugs fixed: * Wrong tab foreground colour for unmodified documents. * Fixed crashes when closing dialogs by clicking X on some systems. - * Fix missing global tags for C files when a C++ source file was + * Fixed missing global tags for C files when a C++ source file was loaded first. + * Fixed autocompletion missing tag matches.
Geany 0.10 (December 21, 2006)
Modified: branches/geany-0.10.1/tagmanager/include/tm_tag.h =================================================================== --- branches/geany-0.10.1/tagmanager/include/tm_tag.h 2007-02-07 12:28:09 UTC (rev 1253) +++ branches/geany-0.10.1/tagmanager/include/tm_tag.h 2007-02-07 12:44:37 UTC (rev 1254) @@ -281,7 +281,8 @@ \param name Name of the tag to locate. \param partial If TRUE, matches the first part of the name instead of doing exact match. */ -TMTag **tm_tags_find(GPtrArray *sorted_tags_array, const char *name, gboolean partial, int * tagCount); +TMTag **tm_tags_find(const GPtrArray *sorted_tags_array, const char *name, + gboolean partial, int * tagCount);
/*! Completely frees an array of tags.
Modified: branches/geany-0.10.1/tagmanager/tm_tag.c =================================================================== --- branches/geany-0.10.1/tagmanager/tm_tag.c 2007-02-07 12:28:09 UTC (rev 1253) +++ branches/geany-0.10.1/tagmanager/tm_tag.c 2007-02-07 12:44:37 UTC (rev 1254) @@ -562,7 +562,8 @@ } }
-TMTag **tm_tags_find(GPtrArray *sorted_tags_array, const char *name, gboolean partial, int * tagCount) +TMTag **tm_tags_find(const GPtrArray *sorted_tags_array, const char *name, + gboolean partial, int * tagCount) { static TMTag *tag = NULL; TMTag **result; @@ -578,15 +579,30 @@ s_partial = partial; result = (TMTag **) bsearch(&tag, sorted_tags_array->pdata, sorted_tags_array->len , sizeof(gpointer), tm_tag_compare); + // there can be matches on both sides of result if (result) { - for (; result >= (TMTag **) sorted_tags_array->pdata; -- result) { + TMTag **last = (TMTag **) &sorted_tags_array->pdata[sorted_tags_array->len - 1]; + TMTag **adv; + + // First look for any matches after result + adv = result; + adv++; + for (; *adv && adv <= last; ++ adv) + { + if (0 != tm_tag_compare(&tag, adv)) + break; + ++tagMatches; + } + // Now look for matches from result and below + for (; result >= (TMTag **) sorted_tags_array->pdata; -- result) + { if (0 != tm_tag_compare(&tag, (TMTag **) result)) break; ++tagMatches; } *tagCount=tagMatches; - ++ result; + ++ result; // correct address for the last successful match } s_partial = FALSE; return (TMTag **) result;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.