0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.1.1932: ml_get errors after using append()

Problem:    Ml_get errors after using append(). (Alex Genco)
Solution:   Do not update the cursor twice. (closes #1737)
This commit is contained in:
Bram Moolenaar 2019-08-27 21:56:06 +02:00
parent ea7a08a53e
commit d20070274c
3 changed files with 18 additions and 1 deletions

View File

@ -1440,8 +1440,14 @@ set_buffer_lines(
tabpage_T *tp; tabpage_T *tp;
appended_lines_mark(append_lnum, added); 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) 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; wp->w_cursor.lnum += added;
check_cursor_col(); check_cursor_col();
update_topline(); update_topline();

View File

@ -705,6 +705,15 @@ func Test_mode()
set complete& set complete&
endfunc endfunc
func Test_append()
enew!
split
call append(0, ["foo"])
split
only
undo
endfunc
func Test_getbufvar() func Test_getbufvar()
let bnr = bufnr('%') let bnr = bufnr('%')
let b:var_num = '1234' let b:var_num = '1234'

View File

@ -761,6 +761,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1932,
/**/ /**/
1931, 1931,
/**/ /**/