0
0
mirror of https://github.com/vim/vim.git synced 2025-10-26 09:14:23 -04:00

patch 8.1.0971: failure for selecting quoted text object moves cursor

Problem:    Failure for selecting quoted text object moves cursor.
Solution:   Restore the Visual selection on failure. (Christian Brabandt,
            closes #4024)
This commit is contained in:
Bram Moolenaar
2019-02-22 15:04:17 +01:00
parent ed79d1e348
commit 55d3bdbbe2
3 changed files with 54 additions and 11 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!