SF.net SVN: geany:[5780] branches/0.20.1
colombanw at users.sourceforge.net
colombanw at xxxxx
Mon May 9 17:36:39 UTC 2011
Revision: 5780
http://geany.svn.sourceforge.net/geany/?rev=5780&view=rev
Author: colombanw
Date: 2011-05-09 17:36:39 +0000 (Mon, 09 May 2011)
Log Message:
-----------
When sorting tags by line, also sort by scope if line is the same
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).
Modified Paths:
--------------
branches/0.20.1/ChangeLog
branches/0.20.1/src/symbols.c
Modified: branches/0.20.1/ChangeLog
===================================================================
--- branches/0.20.1/ChangeLog 2011-05-09 17:36:20 UTC (rev 5779)
+++ branches/0.20.1/ChangeLog 2011-05-09 17:36:39 UTC (rev 5780)
@@ -4,6 +4,10 @@
Don't remove and add the symbols tree view if we re-add the same one.
* tagmanager/c.c:
Plug a memory leak.
+ * src/symbols.c:
+ When sorting tags by line, also sort by scope if line is the same, avoiding
+ wrong sorting 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).
2011-05-08 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: branches/0.20.1/src/symbols.c
===================================================================
--- branches/0.20.1/src/symbols.c 2011-05-09 17:36:20 UTC (rev 5779)
+++ branches/0.20.1/src/symbols.c 2011-05-09 17:36:39 UTC (rev 5780)
@@ -451,16 +451,27 @@
}
-/* sort by line only */
+/* sort by line, then scope */
static gint compare_symbol_lines(gconstpointer a, gconstpointer b)
{
const TMTag *tag_a = TM_TAG(a);
const TMTag *tag_b = TM_TAG(b);
+ gint ret;
if (a == NULL || b == NULL)
return 0;
- return tag_a->atts.entry.line - tag_b->atts.entry.line;
+ ret = tag_a->atts.entry.line - tag_b->atts.entry.line;
+ if (ret == 0)
+ {
+ if (tag_a->atts.entry.scope == NULL)
+ return -(tag_a->atts.entry.scope != tag_b->atts.entry.scope);
+ if (tag_b->atts.entry.scope == NULL)
+ return tag_a->atts.entry.scope != tag_b->atts.entry.scope;
+ else
+ return strcmp(tag_a->atts.entry.scope, tag_b->atts.entry.scope);
+ }
+ return ret;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list