" Test for edit functions
"
if exists("+t_kD")
let &t_kD="[3;*~"
endif
" Needed for testing basic rightleft: Test_edit_rightleft
source view_util.vim
" Needs to come first until the bug in getchar() is
" fixed: https://groups.google.com/d/msg/vim_dev/fXL9yme4H4c/bOR-U6_bAQAJ
func! Test_edit_00b()
new
call setline(1, ['abc '])
inoreabbr <buffer> h here some more
call cursor(1, 4)
" <c-l> expands the abbreviation and ends insertmode
call feedkeys(":set im\<cr> h\<c-l>:set noim\<cr>", 'tix')
call assert_equal(['abc here some more '], getline(1,'$'))
iunabbr <buffer> h
bw!
endfunc
func! Test_edit_01()
" set for Travis CI?
" set nocp noesckeys
new
" 1) empty buffer
call assert_equal([''], getline(1,'$'))
" 2) delete in an empty line
call feedkeys("i\<del>\<esc>", 'tnix')
call assert_equal([''], getline(1,'$'))
%d
" 3) delete one character
call setline(1, 'a')
call feedkeys("i\<del>\<esc>", 'tnix')
call assert_equal([''], getline(1,'$'))
%d
" 4) delete a multibyte character
if has("multi_byte")
call setline(1, "\u0401")
call feedkeys("i\<del>\<esc>", 'tnix')
call assert_equal([''], getline(1,'$'))
%d
endif
" 5.1) delete linebreak with 'bs' option containing eol
let _bs=&bs
set bs=eol
call setline(1, ["abc def", "ghi jkl"])
call cursor(1, 1)
call feedkeys("A\<del>\<esc>", 'tnix')
call assert_equal(['abc defghi jkl'], getline(1, 2))
%d
" 5.2) delete linebreak with backspace option w/out eol
set bs=
call setline(1, ["abc def", "ghi jkl"])
call cursor(1, 1)
call feedkeys("A\<del>\<esc>", 'tnix')
call assert_equal(["abc def", "ghi jkl"], getline(1, 2))
let &bs=_bs
bw!
endfunc
func! Test_edit_02()
" Change cursor position in InsertCharPre command
new
call setline(1, 'abc')
call cursor(1,