aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2021-05-02 16:47:36 -0400
committerGitHub <noreply@github.com>2021-05-02 16:47:36 -0400
commita0da4c3a491f715c28f70bc2295be5fe809d72c2 (patch)
tree2ce50e4c9ca8dc3b1cb6c79460dc76cd463b74ea
parentcfaf666ac9e1020f75dddb66027e36ad5fed0c86 (diff)
parent4d5516dc059038b5609874dc0c1c8164e364b7ac (diff)
downloadrneovim-a0da4c3a491f715c28f70bc2295be5fe809d72c2.tar.gz
rneovim-a0da4c3a491f715c28f70bc2295be5fe809d72c2.tar.bz2
rneovim-a0da4c3a491f715c28f70bc2295be5fe809d72c2.zip
Merge pull request #14455 from Sh3Rm4n/fix_get_str_line
[RDY] Fix get str line
-rw-r--r--src/nvim/ex_cmds2.c15
-rw-r--r--src/nvim/message.c12
2 files changed, 13 insertions, 14 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 950a1a436f..317ca465e1 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -2719,16 +2719,13 @@ static char_u *get_str_line(int c, void *cookie, int indent, bool do_concat)
while (!(p->buf[i] == '\n' || p->buf[i] == '\0')) {
i++;
}
- char buf[2046];
- char *dst;
- dst = xstpncpy(buf, (char *)p->buf + p->offset, i - p->offset);
- if ((uint32_t)(dst - buf) != i - p->offset) {
- smsg(_(":source error parsing command %s"), p->buf);
- return NULL;
- }
- buf[i - p->offset] = '\0';
+ size_t line_length = i - p->offset;
+ garray_T ga;
+ ga_init(&ga, (int)sizeof(char_u), (int)line_length);
+ ga_concat_len(&ga, (char *)p->buf + p->offset, line_length);
+ ga_append(&ga, '\0');
p->offset = i + 1;
- return (char_u *)xstrdup(buf);
+ return ga.ga_data;
}
static int source_using_linegetter(void *cookie,
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 7c98d3c6b5..1783f62247 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -2265,12 +2265,14 @@ void msg_scroll_up(bool may_throttle)
/// per screen update.
///
/// NB: The bookkeeping is quite messy, and rests on a bunch of poorly
-/// documented assumtions. For instance that the message area always grows while
-/// being throttled, messages are only being output on the last line etc.
+/// documented assumptions. For instance that the message area always grows
+/// while being throttled, messages are only being output on the last line
+/// etc.
///
-/// Probably message scrollback storage should reimplented as a file_buffer, and
-/// message scrolling in TUI be reimplemented as a modal floating window. Then
-/// we get throttling "for free" using standard redraw_later code paths.
+/// Probably message scrollback storage should be reimplemented as a
+/// file_buffer, and message scrolling in TUI be reimplemented as a modal
+/// floating window. Then we get throttling "for free" using standard
+/// redraw_later code paths.
void msg_scroll_flush(void)
{
if (msg_grid.throttled) {