From 684640f5518a483cf2bc48efc8f68449379cef69 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sat, 23 Oct 2021 15:10:28 -0400 Subject: vim-patch:8.1.0306: plural messages are not translated properly Problem: Plural messages are not translated properly. Solution: Add more usage of NGETTEXT(). (Sergey Alyoshin) https://github.com/vim/vim/commit/da6e8919e75fa8f961d1b805e877c8a92e76dafb --- src/nvim/misc1.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'src/nvim/misc1.c') diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index f4f2690e47..561bcd4929 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -686,20 +686,14 @@ void msgmore(long n) } if (pn > p_report) { - if (pn == 1) { - if (n > 0) { - STRLCPY(msg_buf, _("1 more line"), MSG_BUF_LEN); - } else { - STRLCPY(msg_buf, _("1 line less"), MSG_BUF_LEN); - } + if (n > 0) { + vim_snprintf(msg_buf, MSG_BUF_LEN, + NGETTEXT("%ld more line", "%ld more lines", pn), + pn); } else { - if (n > 0) { - vim_snprintf(msg_buf, MSG_BUF_LEN, - _("%" PRId64 " more lines"), (int64_t)pn); - } else { - vim_snprintf(msg_buf, MSG_BUF_LEN, - _("%" PRId64 " fewer lines"), (int64_t)pn); - } + vim_snprintf(msg_buf, MSG_BUF_LEN, + NGETTEXT("%ld line less", "%ld fewer lines", pn), + pn); } if (got_int) { xstrlcat(msg_buf, _(" (Interrupted)"), MSG_BUF_LEN); -- cgit From efa924f66b183d9cf2404ce91c4f009c27e0515a Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 18 Oct 2021 09:08:46 -0400 Subject: vim-patch:8.1.0743: giving error messages is not flexible Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d --- src/nvim/misc1.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/nvim/misc1.c') diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index 561bcd4929..a412078721 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -920,7 +920,7 @@ int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg) } if (*p_sh == NUL) { - EMSG(_(e_shellempty)); + emsg(_(e_shellempty)); retval = -1; } else { // The external command may update a tags file, clear cached tags. @@ -958,7 +958,7 @@ char_u *get_cmd_output(char_u *cmd, char_u *infile, ShellOpts flags, size_t *ret // get a name for the temp file char_u *tempname = vim_tempname(); if (tempname == NULL) { - EMSG(_(e_notmp)); + emsg(_(e_notmp)); return NULL; } @@ -979,7 +979,7 @@ char_u *get_cmd_output(char_u *cmd, char_u *infile, ShellOpts flags, size_t *ret FILE *fd = os_fopen((char *)tempname, READBIN); if (fd == NULL) { - EMSG2(_(e_notopen), tempname); + semsg(_(e_notopen), tempname); goto done; } @@ -992,7 +992,7 @@ char_u *get_cmd_output(char_u *cmd, char_u *infile, ShellOpts flags, size_t *ret fclose(fd); os_remove((char *)tempname); if (i != len) { - EMSG2(_(e_notread), tempname); + semsg(_(e_notread), tempname); XFREE_CLEAR(buffer); } else if (ret_len == NULL) { // Change NUL into SOH, otherwise the string is truncated. -- cgit From e6ff154be6da8bd53b604fb6e38686acae75b24f Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sat, 23 Oct 2021 16:04:37 -0400 Subject: vim-patch:8.1.0779: argument for message functions is inconsistent Problem: Argument for message functions is inconsistent. Solution: Make first argument to msg() "char *". https://github.com/vim/vim/commit/32526b3c1846025f0e655f41efd4e5428da16b6c --- src/nvim/misc1.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/nvim/misc1.c') diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index a412078721..faf0b0f633 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -589,7 +589,7 @@ int get_number(int colon, int *mouse_used) ++typed; } else if (c == K_DEL || c == K_KDEL || c == K_BS || c == Ctrl_H) { if (typed > 0) { - MSG_PUTS("\b \b"); + msg_puts("\b \b"); --typed; } n /= 10; @@ -629,10 +629,10 @@ int prompt_for_number(int *mouse_used) // When using ":silent" assume that was entered. if (mouse_used != NULL) { - MSG_PUTS(_("Type number and or click with the mouse " + msg_puts(_("Type number and or click with the mouse " "(q or empty cancels): ")); } else { - MSG_PUTS(_("Type number and (q or empty cancels): ")); + msg_puts(_("Type number and (q or empty cancels): ")); } /* Set the state such that text can be selected/copied/pasted and we still @@ -698,7 +698,7 @@ void msgmore(long n) if (got_int) { xstrlcat(msg_buf, _(" (Interrupted)"), MSG_BUF_LEN); } - if (msg((char_u *)msg_buf)) { + if (msg(msg_buf)) { set_keep_msg((char_u *)msg_buf, 0); keep_msg_more = true; } -- cgit