From a0dac399d0c23f5d281533b5a593afb4e853523a Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 9 Aug 2025 23:27:13 -0400 Subject: [PATCH] vim-patch:8.1.1681: insert stray "{" when listener gets buffer line Problem: Insert stray "{" when listener gets buffer line. (Paul Jolly) Solution: Flush the cached line after invoking listeners. (closes vim/vim#4455) https://github.com/vim/vim/commit/0fb286e82d28730fcb3293894dd4df2e069eaf9a Co-authored-by: Bram Moolenaar (cherry picked from commit 83f38800e7f99ed1ed352b71ab86471ee5e8f54e) --- src/nvim/memline.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 33ab0f9382..384cd00c5a 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -2039,6 +2039,9 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char *line, colnr_T len, boo if (len == 0) { len = (colnr_T)strlen(line) + 1; // space needed for the text } + if (curbuf->b_ml.ml_line_lnum != 0) { + ml_flush_line(curbuf, false); + } int space_needed = len + (int)INDEX_SIZE; // space needed for text + index memfile_T *mfp = buf->b_ml.ml_mfp;