vim-patch:8.1.0971: failure to select quoted text obj moves cursor #9658

closes #9640

Problem:    Failure for selecting quoted text object moves cursor.
Solution:   Restore the Visual selection on failure. (Christian Brabandt,
            closes vim/vim#4024)
55d3bdbbe2
This commit is contained in:
Pierre
2019-03-03 11:04:32 +01:00
committed by Justin M. Keyes
parent 7a6da502b9
commit 14c53e4cbe
2 changed files with 67 additions and 21 deletions

View File

@@ -52,6 +52,31 @@ func Test_quote_selection_selection_exclusive()
bw!
endfunc
func Test_quote_selection_selection_exclusive_abort()
new
set selection=exclusive
call setline(1, "'abzzc'")
let exp_curs = [0, 1, 6, 0]
call cursor(1,1)
exe 'norm! fcdvi"'
" make sure to end visual mode to have a clear state
exe "norm! \<esc>"
call assert_equal(exp_curs, getpos('.'))
call cursor(1,1)
exe 'norm! fcvi"'
exe "norm! \<esc>"
call assert_equal(exp_curs, getpos('.'))
call cursor(1,2)
exe 'norm! vfcoi"'
exe "norm! \<esc>"
let exp_curs = [0, 1, 2, 0]
let exp_visu = [0, 1, 7, 0]
call assert_equal(exp_curs, getpos('.'))
call assert_equal(exp_visu, getpos("'>"))
set selection&vim
bw!
endfunc
" Tests for string and html text objects
func Test_string_html_objects()
enew!