SF.net SVN: geany: [1808] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Aug 16 17:19:17 UTC 2007


Revision: 1808
          http://geany.svn.sourceforge.net/geany/?rev=1808&view=rev
Author:   ntrel
Date:     2007-08-16 10:19:16 -0700 (Thu, 16 Aug 2007)

Log Message:
-----------
Fix symbol list sort by appearance order for e.g. geany.txt.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/symbols.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-08-16 16:56:17 UTC (rev 1807)
+++ trunk/ChangeLog	2007-08-16 17:19:16 UTC (rev 1808)
@@ -13,6 +13,8 @@
    Clear unnecessary default Scintilla Ctrl-D duplicate keybinding.
    Add SCI_DELWORDRIGHTEND command (patch sent to Scintilla ML).
    Remove previous ScintillaGTK::KeyCommand override.
+ * src/symbols.c:
+   Fix symbol list sort by appearance order for e.g. geany.txt.
 
 
 2007-08-16  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/symbols.c
===================================================================
--- trunk/src/symbols.c	2007-08-16 16:56:17 UTC (rev 1807)
+++ trunk/src/symbols.c	2007-08-16 17:19:16 UTC (rev 1808)
@@ -304,7 +304,7 @@
 } GeanySymbol;
 
 
-/* wrapper function to let strcmp work with GeanySymbol struct */
+/* sort by name, line */
 static gint compare_symbol(const GeanySymbol *a, const GeanySymbol *b)
 {
 	gint ret;
@@ -320,6 +320,15 @@
 }
 
 
+/* sort by line only */
+static gint compare_symbol_lines(const GeanySymbol *a, const GeanySymbol *b)
+{
+	if (a == NULL || b == NULL) return 0;
+
+	return a->line - b->line;
+}
+
+
 static const GList *get_tag_list(gint idx, guint tag_types, gboolean sort_by_name)
 {
 	static GList *tag_names = NULL;
@@ -386,6 +395,8 @@
 		}
 		if (sort_by_name)
 			tag_names = g_list_sort(tag_names, (GCompareFunc) compare_symbol);
+		else
+			tag_names = g_list_sort(tag_names, (GCompareFunc) compare_symbol_lines);
 
 		return tag_names;
 	}


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