Mercurial > vim
diff src/ex_cmds.c @ 18977:5bef1043abff v8.2.0049
patch 8.2.0049: command line completion not fully tested
Commit: https://github.com/vim/vim/commit/297610ba4b110c918ffe60c45eb4a1d6ea2daae5
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Dec 27 17:20:55 2019 +0100
patch 8.2.0049: command line completion not fully tested
Problem: Command line completion not fully tested.
Solution: Add more test cases. Make help sorting stable. (Dominique Pelle,
closes #5402)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 27 Dec 2019 17:30:03 +0100 |
parents | 050f5eaa9e50 |
children | 2ef19eed524a |
line wrap: on
line diff
--- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -5341,10 +5341,18 @@ help_compare(const void *s1, const void { 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); } /*