Patch 8.2.0446

9 views
Skip to first unread message

Bram Moolenaar

unread,
Mar 25, 2020, 4:14:26 PM3/25/20
to vim...@googlegroups.com

Patch 8.2.0446
Problem: Listener with undo of deleting all lines not tested.
Solution: Add a test.
Files: src/testdir/test_listener.vim


*** ../vim-8.2.0445/src/testdir/test_listener.vim 2020-02-26 22:05:57.094386589 +0100
--- src/testdir/test_listener.vim 2020-03-25 20:54:50.327997246 +0100
***************
*** 296,301 ****
--- 296,326 ----
call listener_remove(lid)
endfunc

+ func Test_listener_undo_delete_all()
+ new
+ call setline(1, [1, 2, 3, 4])
+ let s:changes = []
+ func s:ExtendList(bufnr, start, end, added, changes)
+ call extend(s:changes, a:changes)
+ endfunc
+ let id = listener_add('s:ExtendList')
+
+ set undolevels& " start new undo block
+ normal! ggdG
+ undo
+ call listener_flush()
+ call assert_equal(2, s:changes->len())
+ " delete removes four lines, empty line remains
+ call assert_equal({'lnum': 1, 'end': 5, 'col': 1, 'added': -4}, s:changes[0])
+ " undo replaces empty line and adds 3 lines
+ call assert_equal({'lnum': 1, 'end': 2, 'col': 1, 'added': 3}, s:changes[1])
+
+ call listener_remove(id)
+ delfunc s:ExtendList
+ unlet s:changes
+ bwipe!
+ endfunc
+
func Test_listener_cleared_newbuf()
func Listener(bufnr, start, end, added, changes)
let g:gotCalled += 1
*** ../vim-8.2.0445/src/version.c 2020-03-25 20:16:23.647676279 +0100
--- src/version.c 2020-03-25 20:40:00.334960804 +0100
***************
*** 740,741 ****
--- 740,743 ----
{ /* Add new patch number below this line */
+ /**/
+ 446,
/**/

--
WOMAN: I didn't know we had a king. I thought we were an autonomous
collective.
DENNIS: You're fooling yourself. We're living in a dictatorship. A
self-perpetuating autocracy in which the working classes--
WOMAN: Oh there you go, bringing class into it again.
DENNIS: That's what it's all about if only people would--
The Quest for the Holy Grail (Monty Python)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages