mirror of
https://github.com/vim/vim.git
synced 2025-09-04 21:33:48 -04:00
patch 8.2.0446: listener with undo of deleting all lines not tested
Problem: Listener with undo of deleting all lines not tested. Solution: Add a test.
This commit is contained in:
parent
f66ca9f1df
commit
a07e31af54
@ -296,6 +296,31 @@ func Test_listener_undo_line_number()
|
|||||||
call listener_remove(lid)
|
call listener_remove(lid)
|
||||||
endfunc
|
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 Test_listener_cleared_newbuf()
|
||||||
func Listener(bufnr, start, end, added, changes)
|
func Listener(bufnr, start, end, added, changes)
|
||||||
let g:gotCalled += 1
|
let g:gotCalled += 1
|
||||||
|
@ -738,6 +738,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
446,
|
||||||
/**/
|
/**/
|
||||||
445,
|
445,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user