aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-01-05 22:45:18 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-01-05 22:45:31 -0500
commit758955d1b6561f720a0ace77369c2a51fb8c2152 (patch)
treef625280a90f0631be2f0e3929dc4649ccc4bf7b0
parent772f4ce9f8de11aa3e1cb26e00fd3f3ac3b062bf (diff)
downloadrneovim-758955d1b6561f720a0ace77369c2a51fb8c2152.tar.gz
rneovim-758955d1b6561f720a0ace77369c2a51fb8c2152.tar.bz2
rneovim-758955d1b6561f720a0ace77369c2a51fb8c2152.zip
vim-patch:8.1.0687: sentence text object in Visual mode is not tested
Problem: Sentence text object in Visual mode is not tested. Solution: Add a test. (Dominique Pelle, closes vim/vim#3758) https://github.com/vim/vim/commit/6d3a1940be9d3f2b079f81baa9b19f839289b69e
-rw-r--r--src/nvim/testdir/test_visual.vim41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim
index 756a455ebd..4a143d665d 100644
--- a/src/nvim/testdir/test_visual.vim
+++ b/src/nvim/testdir/test_visual.vim
@@ -277,3 +277,44 @@ func Test_visual_mode_reset()
set belloff&
endfunc
+
+func Test_Visual_sentence_textobject()
+ new
+ call setline(1, ['First sentence. Second sentence. Third', 'sentence. Fouth sentence'])
+
+ " When start and end of visual area are identical, 'as' or 'is' select
+ " the whole sentence.
+ norm! 1gofdvasy
+ call assert_equal('Second sentence. ', @")
+ norm! 1gofdvisy
+ call assert_equal('Second sentence.', @")
+
+ " When start and end of visual area are not identical, 'as' or 'is'
+ " extend the sentence in direction of the end of the visual area.
+ norm! 1gofdvlasy
+ call assert_equal('d sentence. ', @")
+ norm! gvasy
+ call assert_equal("d sentence. Third\nsentence. ", @")
+
+ norm! 1gofdvlisy
+ call assert_equal('d sentence.', @")
+ norm! gvisy
+ call assert_equal('d sentence. ', @")
+ norm! gvisy
+ call assert_equal("d sentence. Third\nsentence.", @")
+
+ " Extend visual area in opposite direction.
+ norm! 1gofdvhasy
+ call assert_equal(' Second', @")
+ norm! gvasy
+ call assert_equal("First sentence. Second", @")
+
+ norm! 1gofdvhisy
+ call assert_equal('Second', @")
+ norm! gvisy
+ call assert_equal(' Second', @")
+ norm! gvisy
+ call assert_equal('First sentence. Second', @")
+
+ bwipe!
+endfunc