From 563d7b694bc89782c83f6c8ffee2a80d9fdbaabc Mon Sep 17 00:00:00 2001 From: Michael Lingelbach Date: Sun, 31 Jan 2021 09:03:50 -0800 Subject: tests: add test for cursor postion when deleting buffer lines --- test/functional/lua/buffer_updates_spec.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/functional/lua') diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua index 67dc5f5a16..680b74873d 100644 --- a/test/functional/lua/buffer_updates_spec.lua +++ b/test/functional/lua/buffer_updates_spec.lua @@ -225,6 +225,14 @@ describe('lua buffer event callbacks: on_lines', function() eq(1, meths.get_var('listener_cursor_line')) end) + it('has valid cursor position while deleting lines', function() + meths.buf_set_lines(0, 0, -1, true, { "line_1", "line_2", "line_3", "line_4"}) + meths.win_set_cursor(0, {2, 0}) + eq(2, meths.win_get_cursor(0)[1]) + meths.buf_set_lines(0, 0, -1, true, { "line_1", "line_2", "line_3"}) + eq(2, meths.win_get_cursor(0)[1]) + end) + it('does not SEGFAULT when calling win_findbuf in on_detach', function() exec_lua[[ -- cgit