blob: a4c80844a6002dab6f05ac9852ed1ec77454d3e8 [file] [log] [blame]
Bram Moolenaard07c6e12013-11-21 14:21:40 +01001Test for visual mode not being reset causing E315 error.
2STARTTEST
3:so small.vim
Bram Moolenaarc3c766e2017-03-08 22:55:19 +01004:set belloff=all
Bram Moolenaard07c6e12013-11-21 14:21:40 +01005:enew
6:let g:msg="Everything's fine."
7:function! TriggerTheProblem()
8: " At this point there is no visual selection because :call reset it.
9: " Let's restore the selection:
10: normal gv
11: '<,'>del _
12: try
13: exe "normal \<Esc>"
14: catch /^Vim\%((\a\+)\)\=:E315/
15: echom 'Snap! E315 error!'
16: let g:msg='Snap! E315 error!'
17: endtry
18:endfunction
19:enew
20:setl buftype=nofile
21:call append(line('$'), 'Delete this line.')
22:"
23:"
24:" NOTE: this has to be done by a call to a function because executing :del the
25:" ex-way will require the colon operator which resets the visual mode thus
26:" preventing the problem:
27:"
28GV:call TriggerTheProblem()
29:%del _
30:call append(line('$'), g:msg)
31:w! test.out
32:brewind
33ENDTEST
34
35STARTTEST
36:qa!
37ENDTEST
38