comparison src/testdir/test_edit.vim @ 20118:252d2bb90394 v8.2.0614

patch 8.2.0614: get ml_get error when deleting a line in 'completefunc' Commit: https://github.com/vim/vim/commit/ff06f283e3e4b3ec43012dd3b83f8454c98f6639 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 21 22:01:14 2020 +0200 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc' Problem: Get ml_get error when deleting a line in 'completefunc'. (Yegappan Lakshmanan) Solution: Lock the text while evaluating 'completefunc'.
author Bram Moolenaar <Bram@vim.org>
date Tue, 21 Apr 2020 22:15:04 +0200
parents 12518b40c161
children 79cc97206476
comparison
equal deleted inserted replaced
20117:60a0e7ed241d 20118:252d2bb90394
912 call assert_true(1, 'E117 error caught') 912 call assert_true(1, 'E117 error caught')
913 endtry 913 endtry
914 set completefunc= 914 set completefunc=
915 bw! 915 bw!
916 endfunc 916 endfunc
917
918 func Test_edit_completefunc_delete()
919 func CompleteFunc(findstart, base)
920 if a:findstart == 1
921 return col('.') - 1
922 endif
923 normal dd
924 return ['a', 'b']
925 endfunc
926 new
927 set completefunc=CompleteFunc
928 call setline(1, ['', 'abcd', ''])
929 2d
930 call assert_fails("normal 2G$a\<C-X>\<C-U>", 'E565:')
931 bwipe!
932 endfunc
933
917 934
918 func Test_edit_CTRL_Z() 935 func Test_edit_CTRL_Z()
919 " Ctrl-Z when insertmode is not set inserts it literally 936 " Ctrl-Z when insertmode is not set inserts it literally
920 new 937 new
921 call setline(1, 'abc') 938 call setline(1, 'abc')
1238 endfu 1255 endfu
1239 au InsertCharPre <buffer> :call DoIt() 1256 au InsertCharPre <buffer> :call DoIt()
1240 try 1257 try
1241 call feedkeys("ix\<esc>", 'tnix') 1258 call feedkeys("ix\<esc>", 'tnix')
1242 call assert_fails(1, 'textlock') 1259 call assert_fails(1, 'textlock')
1243 catch /^Vim\%((\a\+)\)\=:E523/ " catch E523: not allowed here 1260 catch /^Vim\%((\a\+)\)\=:E565/ " catch E565: not allowed here
1244 endtry 1261 endtry
1245 " TODO: Might be a bug: should x really be inserted here 1262 " TODO: Might be a bug: should x really be inserted here
1246 call assert_equal(['xa'], getline(1, '$')) 1263 call assert_equal(['xa'], getline(1, '$'))
1247 delfu DoIt 1264 delfu DoIt
1248 try 1265 try
1262 endfun 1279 endfun
1263 set completefunc=Complete 1280 set completefunc=Complete
1264 try 1281 try
1265 call feedkeys("i\<c-x>\<c-u>\<esc>", 'tnix') 1282 call feedkeys("i\<c-x>\<c-u>\<esc>", 'tnix')
1266 call assert_fails(1, 'change in complete function') 1283 call assert_fails(1, 'change in complete function')
1267 catch /^Vim\%((\a\+)\)\=:E523/ " catch E523 1284 catch /^Vim\%((\a\+)\)\=:E565/ " catch E565
1268 endtry 1285 endtry
1269 delfu Complete 1286 delfu Complete
1270 set completefunc= 1287 set completefunc=
1271 if has("rightleft") && exists("+fkmap") 1288 if has("rightleft") && exists("+fkmap")
1272 " 4) 'R' when 'fkmap' and 'revins' is set. 1289 " 4) 'R' when 'fkmap' and 'revins' is set.