summaryrefslogtreecommitdiff
path: root/src/testdir/test_textobjects.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-02-22 15:04:17 +0100
committerBram Moolenaar <Bram@vim.org>2019-02-22 15:04:17 +0100
commit55d3bdbbe2bfc7a78b4aa17763788dbddf87cab0 (patch)
tree854f1684ba2c3ef73cecd0820115e544b6a7aafa /src/testdir/test_textobjects.vim
parented79d1e348c40e2432802423bf22e4f7b536bf8a (diff)
downloadvim-git-55d3bdbbe2bfc7a78b4aa17763788dbddf87cab0.tar.gz
patch 8.1.0971: failure for selecting quoted text object moves cursorv8.1.0971
Problem: Failure for selecting quoted text object moves cursor. Solution: Restore the Visual selection on failure. (Christian Brabandt, closes #4024)
Diffstat (limited to 'src/testdir/test_textobjects.vim')
-rw-r--r--src/testdir/test_textobjects.vim25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/testdir/test_textobjects.vim b/src/testdir/test_textobjects.vim
index 3c403ab91..0baabc043 100644
--- a/src/testdir/test_textobjects.vim
+++ b/src/testdir/test_textobjects.vim
@@ -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!