neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 6661cdf2bdfc2a9cd9805c7afd6d6ae556a50126
parent 599cf6f60c1d4e88ad950063a2c3dcf357cef9f8
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Wed, 24 May 2023 07:09:31 +0800

vim-patch:9.0.1575: "file N of M" message is not translated (#23737)

Problem:    "file N of M" message is not translated.
Solution:   Make argument count message translatable. (close vim/vim#12429)

https://github.com/vim/vim/commit/a8490a4952c320f234ae4528d4a1e812a27f3a0a

Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat:
Msrc/nvim/buffer.c | 27++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c @@ -3514,23 +3514,20 @@ bool append_arg_number(win_T *wp, char *buf, int buflen, bool add_file) return false; } - char *p = buf + strlen(buf); // go to the end of the buffer - - // Early out if the string is getting too long - if (p - buf + 35 >= buflen) { - return false; + const char *msg; + switch ((wp->w_arg_idx_invalid ? 1 : 0) + (add_file ? 2 : 0)) { + case 0: + msg = _(" (%d of %d)"); break; + case 1: + msg = _(" ((%d) of %d)"); break; + case 2: + msg = _(" (file %d of %d)"); break; + case 3: + msg = _(" (file (%d) of %d)"); break; } - *p++ = ' '; - *p++ = '('; - if (add_file) { - STRCPY(p, "file "); - p += 5; - } - vim_snprintf(p, (size_t)(buflen - (p - buf)), - wp->w_arg_idx_invalid - ? "(%d) of %d)" - : "%d of %d)", wp->w_arg_idx + 1, ARGCOUNT); + char *p = buf + strlen(buf); // go to the end of the buffer + vim_snprintf(p, (size_t)(buflen - (p - buf)), msg, wp->w_arg_idx + 1, ARGCOUNT); return true; }