aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2022-03-08 21:38:10 +0000
committerGitHub <noreply@github.com>2022-03-08 21:38:10 +0000
commitf24121ad96d7f560a36f0d977766d4e8232fbda6 (patch)
treef5484ad430a4306c41ec6eee9e60b255ef241e23
parent4632729459552fe168f23831a70c77a5fe40013a (diff)
downloadrneovim-f24121ad96d7f560a36f0d977766d4e8232fbda6.tar.gz
rneovim-f24121ad96d7f560a36f0d977766d4e8232fbda6.tar.bz2
rneovim-f24121ad96d7f560a36f0d977766d4e8232fbda6.zip
fix(line continuation): set growsize to correct value (#17655)
Using MAX always sets growsize to 8000, unless ga_len is larger...
-rw-r--r--src/nvim/ex_cmds2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 8666c7e33a..4493fb430b 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -1698,7 +1698,7 @@ static bool concat_continued_line(garray_T *const ga, const int init_growsize,
return false;
}
if (ga->ga_len > init_growsize) {
- ga_set_growsize(ga, MAX(ga->ga_len, 8000));
+ ga_set_growsize(ga, MIN(ga->ga_len, 8000));
}
ga_concat_len(ga, (const char *)line + 1, len - 1);
return true;
@@ -1852,7 +1852,7 @@ static void cmd_source_buffer(const exarg_T *const eap)
for (linenr_T curr_lnum = eap->line1; curr_lnum <= final_lnum; curr_lnum++) {
// Adjust growsize to current length to speed up concatenating many lines.
if (ga.ga_len > 400) {
- ga_set_growsize(&ga, MAX(ga.ga_len, 8000));
+ ga_set_growsize(&ga, MIN(ga.ga_len, 8000));
}
ga_concat(&ga, (char *)ml_get(curr_lnum));
ga_append(&ga, NL);