diff src/testdir/test_textobjects.vim @ 34090:f425f4870873 v9.1.0012

patch 9.1.0012: regression with empty inner blocks introduced Commit: https://github.com/vim/vim/commit/3779516988f14f2070d827514c79383334a0946b Author: Maxim Kim <habamax@gmail.com> Date: Fri Jan 5 17:52:49 2024 +0100 patch 9.1.0012: regression with empty inner blocks introduced Problem: regression with empty inner blocks introduced (after v9.1.0007) Solution: Set correct cursor position, Check for visual mode being active (Maxim Kim) relates: #13514 closes: #13819 Signed-off-by: Maxim Kim <habamax@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Fri, 05 Jan 2024 18:00:04 +0100
parents 21fc3f1676be
children
line wrap: on
line diff
--- a/src/testdir/test_textobjects.vim
+++ b/src/testdir/test_textobjects.vim
@@ -643,7 +643,7 @@ endfunc
 
 func Test_inner_block_empty_paren()
   new
-  call setline(1, ["(text)()", "", "(text)(", ")", "", "()()"])
+  call setline(1, ["(text)()", "", "(text)(", ")", "", "()()", "", "text()"])
 
   " Example 1
   call cursor(1, 1)
@@ -665,12 +665,18 @@ func Test_inner_block_empty_paren()
   call assert_beeps('call feedkeys("0f(viby", "xt")')
   call assert_equal(3, getpos('.')[2])
   call assert_equal('(', @")
+
+  " Change empty inner block
+  call cursor(8, 1)
+  call feedkeys("0cibtext", "xt")
+  call assert_equal("text(text)", getline('.'))
+
   bwipe!
 endfunc
 
 func Test_inner_block_empty_bracket()
   new
-  call setline(1, ["[text][]", "", "[text][", "]", "", "[][]"])
+  call setline(1, ["[text][]", "", "[text][", "]", "", "[][]", "", "text[]"])
 
   " Example 1
   call cursor(1, 1)
@@ -692,12 +698,18 @@ func Test_inner_block_empty_bracket()
   call assert_beeps('call feedkeys("0f[viby", "xt")')
   call assert_equal(3, getpos('.')[2])
   call assert_equal('[', @")
+
+  " Change empty inner block
+  call cursor(8, 1)
+  call feedkeys("0ci[text", "xt")
+  call assert_equal("text[text]", getline('.'))
+
   bwipe!
 endfunc
 
 func Test_inner_block_empty_brace()
   new
-  call setline(1, ["{text}{}", "", "{text}{", "}", "", "{}{}"])
+  call setline(1, ["{text}{}", "", "{text}{", "}", "", "{}{}", "", "text{}"])
 
   " Example 1
   call cursor(1, 1)
@@ -719,6 +731,12 @@ func Test_inner_block_empty_brace()
   call assert_beeps('call feedkeys("0f{viby", "xt")')
   call assert_equal(3, getpos('.')[2])
   call assert_equal('{', @")
+
+  " Change empty inner block
+  call cursor(8, 1)
+  call feedkeys("0ciBtext", "xt")
+  call assert_equal("text{text}", getline('.'))
+
   bwipe!
 endfunc