mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
fix(api): handle clearing out last line of non-current buffer
fixes #24911
This commit is contained in:
parent
3a876bd41b
commit
132bbd1cbd
@ -2523,7 +2523,7 @@ static int ml_delete_int(buf_T *buf, linenr_T lnum, bool message)
|
|||||||
set_keep_msg(_(no_lines_msg), 0);
|
set_keep_msg(_(no_lines_msg), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = ml_replace(1, "", true);
|
int i = ml_replace_buf(buf, 1, "", true);
|
||||||
buf->b_ml.ml_flags |= ML_EMPTY;
|
buf->b_ml.ml_flags |= ML_EMPTY;
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
|
@ -279,6 +279,18 @@ describe('api/buf', function()
|
|||||||
]]}
|
]]}
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('handles clearing out non-current buffer #24911', function()
|
||||||
|
local buf = meths.get_current_buf()
|
||||||
|
meths.buf_set_lines(buf, 0, -1, true, {"aaa", "bbb", "ccc"})
|
||||||
|
command("new")
|
||||||
|
|
||||||
|
meths.buf_set_lines(0, 0, -1, true, {"xxx", "yyy", "zzz"})
|
||||||
|
|
||||||
|
meths.buf_set_lines(buf, 0, -1, true, {})
|
||||||
|
eq({"xxx", "yyy", "zzz"}, meths.buf_get_lines(0, 0, -1, true))
|
||||||
|
eq({''}, meths.buf_get_lines(buf, 0, -1, true))
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('deprecated: {get,set,del}_line', function()
|
describe('deprecated: {get,set,del}_line', function()
|
||||||
|
Loading…
Reference in New Issue
Block a user