summaryrefslogtreecommitdiff
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-27 17:20:55 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-27 17:20:55 +0100
commit297610ba4b110c918ffe60c45eb4a1d6ea2daae5 (patch)
treeee04b17c7069ce83dd0f7f19ec30d1a9d58b7298 /src/ex_cmds.c
parent5c463a28fff1d82222d49bc7960da9e0c866b060 (diff)
downloadvim-git-297610ba4b110c918ffe60c45eb4a1d6ea2daae5.tar.gz
patch 8.2.0049: command line completion not fully testedv8.2.0049
Problem: Command line completion not fully tested. Solution: Add more test cases. Make help sorting stable. (Dominique Pelle, closes #5402)
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 491049194..c8a93bc0a 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -5341,10 +5341,18 @@ help_compare(const void *s1, const void *s2)
{
char *p1;
char *p2;
+ int cmp;
p1 = *(char **)s1 + strlen(*(char **)s1) + 1;
p2 = *(char **)s2 + strlen(*(char **)s2) + 1;
- return strcmp(p1, p2);
+
+ // Compare by help heuristic number first.
+ cmp = strcmp(p1, p2);
+ if (cmp != 0)
+ return cmp;
+
+ // Compare by strings as tie-breaker when same heuristic number.
+ return strcmp(*(char **)s1, *(char **)s2);
}
/*