mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:7.4.2152
Problem: No proper translation of messages with a count.
Solution: Use ngettext(). (Sergey Alyoshin)
ee695f787a
This commit is contained in:
parent
f0c12012d9
commit
c5d7eaf664
@ -8663,7 +8663,6 @@ static void f_foldtext(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
char_u *r;
|
||||
int len;
|
||||
char *txt;
|
||||
long count;
|
||||
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = NULL;
|
||||
@ -8691,8 +8690,8 @@ static void f_foldtext(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
s = skipwhite(s + 1);
|
||||
}
|
||||
}
|
||||
count = (long)(foldend - foldstart + 1);
|
||||
txt = _("+-%s%3ld lines: ");
|
||||
unsigned long count = (unsigned long)(foldend - foldstart + 1);
|
||||
txt = ngettext("+-%s%3ld line: ", "+-%s%3ld lines: ", count);
|
||||
r = xmalloc(STRLEN(txt)
|
||||
+ STRLEN(dashes) // for %s
|
||||
+ 20 // for %3ld
|
||||
@ -8712,7 +8711,7 @@ static void f_foldtext(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
static void f_foldtextresult(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
{
|
||||
char_u *text;
|
||||
char_u buf[51];
|
||||
char_u buf[FOLD_TEXT_LEN];
|
||||
foldinfo_T foldinfo;
|
||||
int fold_count;
|
||||
|
||||
|
@ -1689,12 +1689,10 @@ static void foldDelMarker(linenr_T lnum, char_u *marker, size_t markerlen)
|
||||
}
|
||||
}
|
||||
|
||||
/* get_foldtext() {{{2 */
|
||||
/*
|
||||
* Return the text for a closed fold at line "lnum", with last line "lnume".
|
||||
* When 'foldtext' isn't set puts the result in "buf[51]". Otherwise the
|
||||
* result is in allocated memory.
|
||||
*/
|
||||
// get_foldtext() {{{2
|
||||
/// Return the text for a closed fold at line "lnum", with last line "lnume".
|
||||
/// When 'foldtext' isn't set puts the result in "buf[FOLD_TEXT_LEN]".
|
||||
/// Otherwise the result is in allocated memory.
|
||||
char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume,
|
||||
foldinfo_T *foldinfo, char_u *buf)
|
||||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
@ -1781,8 +1779,12 @@ char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume,
|
||||
}
|
||||
}
|
||||
if (text == NULL) {
|
||||
sprintf((char *)buf, _("+--%3ld lines folded "),
|
||||
(long)(lnume - lnum + 1));
|
||||
unsigned long count = (unsigned long)(lnume - lnum + 1);
|
||||
|
||||
vim_snprintf((char *)buf, FOLD_TEXT_LEN,
|
||||
ngettext("+--%3ld line folded",
|
||||
"+--%3ld lines folded ", count),
|
||||
count);
|
||||
text = buf;
|
||||
}
|
||||
return text;
|
||||
|
@ -1684,7 +1684,7 @@ static int compute_foldcolumn(win_T *wp, int col)
|
||||
*/
|
||||
static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T lnum, int row)
|
||||
{
|
||||
char_u buf[51];
|
||||
char_u buf[FOLD_TEXT_LEN];
|
||||
pos_T *top, *bot;
|
||||
linenr_T lnume = lnum + fold_count - 1;
|
||||
int len;
|
||||
|
@ -289,7 +289,7 @@ static const int included_patches[] = {
|
||||
// 2155 NA
|
||||
// 2154 NA
|
||||
// 2153 NA
|
||||
// 2152,
|
||||
2152,
|
||||
2151,
|
||||
// 2150 NA
|
||||
2149,
|
||||
|
@ -204,6 +204,8 @@ enum {
|
||||
|
||||
#define DIALOG_MSG_SIZE 1000 /* buffer size for dialog_msg() */
|
||||
|
||||
enum { FOLD_TEXT_LEN = 51 }; //!< buffer size for get_foldtext()
|
||||
|
||||
/*
|
||||
* Maximum length of key sequence to be mapped.
|
||||
* Must be able to hold an Amiga resize report.
|
||||
|
Loading…
Reference in New Issue
Block a user