aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/eval.c7
-rw-r--r--src/nvim/fold.c18
-rw-r--r--src/nvim/screen.c2
-rw-r--r--src/nvim/version.c2
-rw-r--r--src/nvim/vim.h2
5 files changed, 17 insertions, 14 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index dcbd7ab152..60c4e725b7 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -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;
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 34db4d2171..ff3f46cb78 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -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;
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index a8993be4e5..f34dbf5d64 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -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;
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 9a5d7ce169..cd904da573 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -289,7 +289,7 @@ static const int included_patches[] = {
// 2155 NA
// 2154 NA
// 2153 NA
- // 2152,
+ 2152,
2151,
// 2150 NA
2149,
diff --git a/src/nvim/vim.h b/src/nvim/vim.h
index 172e62b039..f29ccdd296 100644
--- a/src/nvim/vim.h
+++ b/src/nvim/vim.h
@@ -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.