]> granicus.if.org Git - vim/commitdiff
patch 8.1.1932: ml_get errors after using append() v8.1.1932
authorBram Moolenaar <Bram@vim.org>
Tue, 27 Aug 2019 19:56:06 +0000 (21:56 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 27 Aug 2019 19:56:06 +0000 (21:56 +0200)
Problem:    Ml_get errors after using append(). (Alex Genco)
Solution:   Do not update the cursor twice. (closes #1737)

src/evalfunc.c
src/testdir/test_functions.vim
src/version.c

index 498e87f0d8a2f7ba27050c9e69c267df69830382..882bf092562b195b5f7cde613d636694f16026e8 100644 (file)
@@ -1440,8 +1440,14 @@ set_buffer_lines(
        tabpage_T   *tp;
 
        appended_lines_mark(append_lnum, added);
+
+       // Only adjust the cursor for buffers other than the current, unless it
+       // is the current window.  For curbuf and other windows it has been
+       // done in mark_adjust_internal().
        FOR_ALL_TAB_WINDOWS(tp, wp)
-           if (wp->w_buffer == buf && wp->w_cursor.lnum > append_lnum)
+           if (wp->w_buffer == buf
+                   && (wp->w_buffer != curbuf || wp == curwin)
+                   && wp->w_cursor.lnum > append_lnum)
                wp->w_cursor.lnum += added;
        check_cursor_col();
        update_topline();
index 027700be755ab4db83fe0a950b114b68dfe82929..1352eaa5df88533341d87d324af38425c2f66fc7 100644 (file)
@@ -705,6 +705,15 @@ func Test_mode()
   set complete&
 endfunc
 
+func Test_append()
+  enew!
+  split
+  call append(0, ["foo"])
+  split
+  only
+  undo
+endfunc
+
 func Test_getbufvar()
   let bnr = bufnr('%')
   let b:var_num = '1234'
index 9c8ff7099d03c79769dc751f830734fd91733ec9..412ae926f1358a03693995d853d5ce6d543411c6 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1932,
 /**/
     1931,
 /**/