SF.net SVN: geany:[5580] trunk
colombanw at users.sourceforge.net
colombanw at xxxxx
Sun Mar 6 17:25:15 UTC 2011
Revision: 5580
http://geany.svn.sourceforge.net/geany/?rev=5580&view=rev
Author: colombanw
Date: 2011-03-06 17:25:15 +0000 (Sun, 06 Mar 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:
--------------
trunk/ChangeLog
trunk/src/symbols.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2011-03-06 17:13:45 UTC (rev 5579)
+++ trunk/ChangeLog 2011-03-06 17:25:15 UTC (rev 5580)
@@ -1,3 +1,11 @@
+2011-03-06 Colomban Wendling <colomban(at)geany(dot)org>
+
+ * 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-03-06 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/interface.c, geany.glade:
Modified: trunk/src/symbols.c
===================================================================
--- trunk/src/symbols.c 2011-03-06 17:13:45 UTC (rev 5579)
+++ trunk/src/symbols.c 2011-03-06 17:25:15 UTC (rev 5580)
@@ -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