diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-01 10:54:41 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-01 11:02:55 +0800 |
commit | 300490f2e8e94ee471685cd9809964c10ebdc1ed (patch) | |
tree | d5e13bc8ca3d21531a98923ce327d380b7d19394 /src/nvim/ex_cmds.c | |
parent | 2268a4147ec1e9f0236fd5eb56c1cc2b751eca05 (diff) | |
download | rneovim-300490f2e8e94ee471685cd9809964c10ebdc1ed.tar.gz rneovim-300490f2e8e94ee471685cd9809964c10ebdc1ed.tar.bz2 rneovim-300490f2e8e94ee471685cd9809964c10ebdc1ed.zip |
vim-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 vim/vim#5402)
https://github.com/vim/vim/commit/297610ba4b110c918ffe60c45eb4a1d6ea2daae5
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r-- | src/nvim/ex_cmds.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 82422a78c3..b5b75b76a9 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -5019,7 +5019,15 @@ static int help_compare(const void *s1, const void *s2) p1 = *(char **)s1 + strlen(*(char **)s1) + 1; p2 = *(char **)s2 + strlen(*(char **)s2) + 1; - return strcmp(p1, p2); + + // Compare by help heuristic number first. + int 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); } /// Find all help tags matching "arg", sort them and return in matches[], with |