summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-03 23:10:32 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-03 23:10:32 +0100
commit6d3a1940be9d3f2b079f81baa9b19f839289b69e (patch)
treeea319c8f14d00158f19c164bbe660450008d4cdd
parent5823f84dd04198994e3e5f2e278a5e315c47d32d (diff)
downloadvim-git-6d3a1940be9d3f2b079f81baa9b19f839289b69e.tar.gz
patch 8.1.0687: sentence text object in Visual mode is not testedv8.1.0687
Problem: Sentence text object in Visual mode is not tested. Solution: Add a test. (Dominique Pelle, closes #3758)
-rw-r--r--src/testdir/test_visual.vim41
-rw-r--r--src/version.c2
2 files changed, 43 insertions, 0 deletions
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index 5b181d309..24105e550 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index 62edc78bc..e9ceeb525 100644
--- a/src/version.c
+++ b/src/version.c
@@ -800,6 +800,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 687,
+/**/
686,
/**/
685,