diff options
author | Jurica Bradaric <jbradaric@gmail.com> | 2016-09-18 17:29:42 +0200 |
---|---|---|
committer | Jurica Bradaric <jbradaric@gmail.com> | 2016-09-25 22:06:57 +0200 |
commit | 6e55d99f433b5da7b3aeeb5585b663bf9bd22cd2 (patch) | |
tree | 4ea0728290389291dcad2453bdfc4c31d4c376a3 | |
parent | 68bcb32ec43e2fab30dc05439fc77cf28793922c (diff) | |
download | rneovim-6e55d99f433b5da7b3aeeb5585b663bf9bd22cd2.tar.gz rneovim-6e55d99f433b5da7b3aeeb5585b663bf9bd22cd2.tar.bz2 rneovim-6e55d99f433b5da7b3aeeb5585b663bf9bd22cd2.zip |
vim-patch:7.4.1671
Problem: When help exists in multiple languages, adding @ab while "ab" is
the default help language is unnecessary.
Solution: Leave out "@ab" when not needed. (Ken Takata)
https://github.com/vim/vim/commit/61264d99692803eec76a171916ab9720c75536b0
-rw-r--r-- | src/nvim/ex_getln.c | 45 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
2 files changed, 32 insertions, 15 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 1a97dc3d6f..7e6bf862d7 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -3669,27 +3669,44 @@ expand_cmdline ( return EXPAND_OK; } -/* - * Cleanup matches for help tags: remove "@en" if "en" is the only language. - */ - +// Cleanup matches for help tags: +// Remove "@ab" if the top of 'helplang' is "ab" and the language of the first +// tag matches it. Otherwise remove "@en" if "en" is the only language. static void cleanup_help_tags(int num_file, char_u **file) { - int i, j; - int len; + char_u buf[4]; + char_u *p = buf; + + if (p_hlg[0] != NUL) { + *p++ = '@'; + *p++ = p_hlg[0]; + *p++ = p_hlg[1]; + } + *p = NUL; - for (i = 0; i < num_file; ++i) { - len = (int)STRLEN(file[i]) - 3; - if (len > 0 && STRCMP(file[i] + len, "@en") == 0) { - /* Sorting on priority means the same item in another language may - * be anywhere. Search all items for a match up to the "@en". */ - for (j = 0; j < num_file; ++j) + for (int i = 0; i < num_file; i++) { + int len = (int)STRLEN(file[i]) - 3; + if (len <= 0) { + continue; + } + if (i == 0 && STRCMP(file[i] + len, buf) == 0) { + file[i][len] = NUL; + break; + } else if (STRCMP(file[i] + len, "@en") == 0) { + // Sorting on priority means the same item in another language may + // be anywhere. Search all items for a match up to the "@en". + int j; + for (j = 0; j < num_file; j++) { if (j != i && (int)STRLEN(file[j]) == len + 3 - && STRNCMP(file[i], file[j], len + 1) == 0) + && STRNCMP(file[i], file[j], len + 1) == 0) { break; - if (j == num_file) + } + } + if (j == num_file) { file[i][len] = NUL; + break; + } } } } diff --git a/src/nvim/version.c b/src/nvim/version.c index 685a2a843b..24c3d4eb5b 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -772,7 +772,7 @@ static int included_patches[] = { // 1674 NA 1673, // 1672 NA - // 1671, + 1671, // 1670, // 1669 NA // 1668 NA |