From 58a3cae3eb590c375bf4823052e8d9d4165050de Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 8 Sep 2022 13:43:10 +0100 Subject: patch 9.0.0416: ml_get error when appending lines in popup window Problem: ml_get error when appending lines in popup window. Solution: Only update w_topline when w_buffer matches curbuf. (closes #11074) --- src/evalbuffer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/evalbuffer.c') diff --git a/src/evalbuffer.c b/src/evalbuffer.c index 15ac58021a..3527737b92 100644 --- a/src/evalbuffer.c +++ b/src/evalbuffer.c @@ -254,7 +254,11 @@ set_buffer_lines( && wp->w_cursor.lnum > append_lnum) wp->w_cursor.lnum += added; check_cursor_col(); - update_topline(); + + // Only update the window view if w_buffer matches curbuf, otherwise + // the computations will be wrong. + if (curwin->w_buffer == curbuf) + update_topline(); } done: -- cgit v1.2.3