mirror of
https://github.com/neovim/neovim.git
synced 2025-09-11 05:48:17 +00:00
vim-patch:8.2.2489: current buffer is wrong after deletebufline() fails
Problem: current buffer is wrong after deletebufline() fails to delete a
line in another buffer.
Solution: Restore the current buffer.
963ffa0a5a
This commit is contained in:
@@ -1629,9 +1629,7 @@ static void f_deletebufline(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
|
||||
if (u_save(first - 1, last + 1) == FAIL) {
|
||||
rettv->vval.v_number = 1; // FAIL
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
for (linenr_T lnum = first; lnum <= last; lnum++) {
|
||||
ml_delete(first, true);
|
||||
}
|
||||
@@ -1650,6 +1648,7 @@ static void f_deletebufline(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
}
|
||||
check_cursor_col();
|
||||
deleted_lines_mark(first, count);
|
||||
}
|
||||
|
||||
if (!is_curbuf) {
|
||||
curbuf = curbuf_save;
|
||||
|
@@ -112,6 +112,17 @@ func Test_deletebufline()
|
||||
call assert_equal(0, deletebufline(b, 1))
|
||||
call assert_equal(['b', 'c'], getbufline(b, 1, 2))
|
||||
exe "bwipe! " . b
|
||||
|
||||
edit XbufOne
|
||||
let one = bufnr()
|
||||
call setline(1, ['a', 'b', 'c'])
|
||||
setlocal nomodifiable
|
||||
split XbufTwo
|
||||
let two = bufnr()
|
||||
call assert_fails('call deletebufline(one, 1)', 'E21:')
|
||||
call assert_equal(two, bufnr())
|
||||
bwipe! XbufTwo
|
||||
bwipe! XbufOne
|
||||
endfunc
|
||||
|
||||
func Test_appendbufline_redraw()
|
||||
|
Reference in New Issue
Block a user