Kaydet (Commit) 3ebfccea authored tarafından Colomban Wendling's avatar Colomban Wendling

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).


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5580 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 76b49acf
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> 2011-03-06 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/interface.c, geany.glade: * src/interface.c, geany.glade:
......
...@@ -451,16 +451,27 @@ static gint compare_symbol(const TMTag *tag_a, const TMTag *tag_b) ...@@ -451,16 +451,27 @@ static gint compare_symbol(const TMTag *tag_a, const TMTag *tag_b)
} }
/* sort by line only */ /* sort by line, then scope */
static gint compare_symbol_lines(gconstpointer a, gconstpointer b) static gint compare_symbol_lines(gconstpointer a, gconstpointer b)
{ {
const TMTag *tag_a = TM_TAG(a); const TMTag *tag_a = TM_TAG(a);
const TMTag *tag_b = TM_TAG(b); const TMTag *tag_b = TM_TAG(b);
gint ret;
if (a == NULL || b == NULL) if (a == NULL || b == NULL)
return 0; 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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment