diff --git a/edit/ChangeLog b/edit/ChangeLog index 9f42d63d6..394c94b3d 100644 --- a/edit/ChangeLog +++ b/edit/ChangeLog @@ -1,3 +1,7 @@ +2006-03-21 Leonard den Ottolander + + * choosesyntax.c: Sort syntax list. + 2006-03-21 Leonard den Ottolander * choosesyntax.c: GPL v2 only. diff --git a/edit/choosesyntax.c b/edit/choosesyntax.c index 9b096ed9a..6195375be 100644 --- a/edit/choosesyntax.c +++ b/edit/choosesyntax.c @@ -25,6 +25,11 @@ #define LIST_LINES 14 #define N_DFLT_ENTRIES 2 +int pstrcmp(p1, p2) char *p1, *p2; +{ + return strcmp(*(char**)p1, *(char**)p2); +} + static int exec_edit_syntax_dialog (const char **names) { int i; @@ -51,6 +56,7 @@ edit_syntax_dialog (void) { char **names; int i; int force_reload = 0; + int count = 0; names = (char**) g_malloc (sizeof (char*)); names[0] = NULL; @@ -58,6 +64,8 @@ edit_syntax_dialog (void) { Instead we could save the list to a file and update it once the syntax file gets updated (either by testing or by explicit user command). */ edit_load_syntax (NULL, &names, NULL); + while (names[count++] != NULL); + qsort(names, count - 1, sizeof(char*), pstrcmp); if ((syntax = exec_edit_syntax_dialog ((const char**) names)) < 0) { for (i = 0; names[i]; i++) {