aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-01 11:49:48 +0800
committerGitHub <noreply@github.com>2022-07-01 11:49:48 +0800
commit8f5bcfb0e4ca3b827bcc46cb05d3530bd97da7db (patch)
tree0bf2bc94da24ed2c0439a1c3660c3515f6b513f1 /src/nvim/ex_cmds.c
parent2268a4147ec1e9f0236fd5eb56c1cc2b751eca05 (diff)
parentb22f7dd9083293f4bef7ddf7ab8c2a20247b1629 (diff)
downloadrneovim-8f5bcfb0e4ca3b827bcc46cb05d3530bd97da7db.tar.gz
rneovim-8f5bcfb0e4ca3b827bcc46cb05d3530bd97da7db.tar.bz2
rneovim-8f5bcfb0e4ca3b827bcc46cb05d3530bd97da7db.zip
Merge pull request #19178 from zeertzjq/vim-8.2.0049
vim-patch:8.2.0049: command line completion not fully tested
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c10
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