diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-06-06 22:50:35 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-06-06 22:50:35 +0200 |
commit | 125370459178b0ca3acc98edca774c390c9b9fa4 (patch) | |
tree | 296eefc52a5cd8cc65b934ef40abafab9ea12653 /src/testdir | |
parent | 773a97c254d02784079fb3b20447620412588850 (diff) | |
download | vim-git-125370459178b0ca3acc98edca774c390c9b9fa4.tar.gz |
patch 8.1.1486: a listener change is merged even when it adds a linev8.1.1486
Problem: A listener change is merged even when it adds a line. (Paul Jolly)
Solution: Do not merge a change that adds or removes a line. (closes #4490)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_listener.vim | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/testdir/test_listener.vim b/src/testdir/test_listener.vim index 16c4c0022..a318d527a 100644 --- a/src/testdir/test_listener.vim +++ b/src/testdir/test_listener.vim @@ -28,9 +28,10 @@ func Test_listening() set undolevels& " start new undo block call append(2, 'two two') undo + call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1}], s:list) redraw - " the two changes get merged - call assert_equal([{'lnum': 3, 'end': 4, 'col': 1, 'added': 0}], s:list) + " the two changes are not merged + call assert_equal([{'lnum': 3, 'end': 4, 'col': 1, 'added': -1}], s:list) 1 " Two listeners, both get called. Also check column. @@ -65,15 +66,16 @@ func Test_listening() call assert_equal([{'lnum': 3, 'end': 3, 'col': 1, 'added': 1}, \ {'lnum': 1, 'end': 2, 'col': 1, 'added': 0}], s:list) - " an insert just above a previous change that was the last one gets merged + " an insert just above a previous change that was the last one does not get + " merged call setline(1, ['one one', 'two']) call listener_flush() let s:list = [] call setline(2, 'something') call append(1, 'two two') - call assert_equal([], s:list) + call assert_equal([{'lnum': 2, 'end': 3, 'col': 1, 'added': 0}], s:list) call listener_flush() - call assert_equal([{'lnum': 2, 'end': 3, 'col': 1, 'added': 1}], s:list) + call assert_equal([{'lnum': 2, 'end': 2, 'col': 1, 'added': 1}], s:list) " an insert above a previous change causes a flush call setline(1, ['one one', 'two']) @@ -86,13 +88,13 @@ func Test_listening() call assert_equal([{'lnum': 1, 'end': 1, 'col': 1, 'added': 1}], s:list) call assert_equal('two two', s:text) - " a delete at a previous change that was the last one gets merged + " a delete at a previous change that was the last one does not get merged call setline(1, ['one one', 'two']) call listener_flush() let s:list = [] call setline(2, 'something') 2del - call assert_equal([], s:list) + call assert_equal([{'lnum': 2, 'end': 3, 'col': 1, 'added': 0}], s:list) call listener_flush() call assert_equal([{'lnum': 2, 'end': 3, 'col': 1, 'added': -1}], s:list) |