aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-05-24 07:09:31 +0800
committerGitHub <noreply@github.com>2023-05-24 07:09:31 +0800
commit6661cdf2bdfc2a9cd9805c7afd6d6ae556a50126 (patch)
tree18c85681558d713d82f66a5153679819fa5640f7
parent599cf6f60c1d4e88ad950063a2c3dcf357cef9f8 (diff)
downloadrneovim-6661cdf2bdfc2a9cd9805c7afd6d6ae556a50126.tar.gz
rneovim-6661cdf2bdfc2a9cd9805c7afd6d6ae556a50126.tar.bz2
rneovim-6661cdf2bdfc2a9cd9805c7afd6d6ae556a50126.zip
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>
-rw-r--r--src/nvim/buffer.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 49fd09ebd0..11b79fcede 100644
--- 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;
}