]> granicus.if.org Git - vim/commitdiff
patch 8.1.0687: sentence text object in Visual mode is not tested v8.1.0687
authorBram Moolenaar <Bram@vim.org>
Thu, 3 Jan 2019 22:10:32 +0000 (23:10 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 3 Jan 2019 22:10:32 +0000 (23:10 +0100)
Problem:    Sentence text object in Visual mode is not tested.
Solution:   Add a test. (Dominique Pelle, closes #3758)

src/testdir/test_visual.vim
src/version.c

index 5b181d30938dbe0f66a39bb42d35c3aacba45995..24105e5506f6ce69a827755bc5db9257e2568673 100644 (file)
@@ -273,3 +273,44 @@ func Test_virtual_replace2()
   %d_
   set bs&vim
 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
index 62edc78bc754c14f0417d23755868c014e74ac1d..e9ceeb525046037f39663f8ac662aefeb550a3c4 100644 (file)
@@ -799,6 +799,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    687,
 /**/
     686,
 /**/