diff options
author | pommicket <pommicket@gmail.com> | 2023-01-03 18:03:00 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-01-03 18:03:00 -0500 |
commit | a648291509aa3b0f91a4b3032b780f1f688379d2 (patch) | |
tree | 9274e1fbb00d5c3b7e13965c9a77ce6a03e492b9 /ide-definitions.c | |
parent | c0397f1f4c80e73a2e4ccd1946703fe6a5bb405e (diff) |
sort go-to-definition entries by detail after name
Diffstat (limited to 'ide-definitions.c')
-rw-r--r-- | ide-definitions.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ide-definitions.c b/ide-definitions.c index 7175e08..185a270 100644 --- a/ide-definitions.c +++ b/ide-definitions.c @@ -113,7 +113,13 @@ static int definition_entry_qsort_cmp(const void *av, const void *bv) { if (a_len < b_len) return -1; if (a_len > b_len) return 1; // then sort alphabetically - return strcmp(a->name, b->name); + int cmp = strcmp(a->name, b->name); + if (cmp) return cmp; + // then sort by detail + if (!a->detail && b->detail) return -1; + if (a->detail && !b->detail) return 1; + if (!a->detail && !b->detail) return 0; + return strcmp(a->detail, b->detail); } // put the entries matching the search term into the selector. |