diff src/testdir/test_textprop.vim @ 16682:7847d281cbbf v8.1.1343

patch 8.1.1343: text properties not adjusted for Visual block mode delete commit https://github.com/vim/vim/commit/8055d17388736421d875dd4933c4c93d49a2ab58 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 17 22:57:26 2019 +0200 patch 8.1.1343: text properties not adjusted for Visual block mode delete Problem: Text properties not adjusted for Visual block mode delete. Solution: Call adjust_prop_columns(). (closes https://github.com/vim/vim/issues/4384)
author Bram Moolenaar <Bram@vim.org>
date Fri, 17 May 2019 23:00:05 +0200
parents 6f453673eb19
children 23af483c4ceb
line wrap: on
line diff
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -613,7 +613,7 @@ func Test_prop_undo()
 endfunc
 
 " screenshot test with textprop highlighting
-funct Test_textprop_screenshots()
+func Test_textprop_screenshot_various()
   " The Vim running in the terminal needs to use utf-8.
   if !CanRunVimInTerminal() || g:orig_encoding != 'utf-8'
     return
@@ -671,3 +671,52 @@ funct Test_textprop_screenshots()
   call StopVimInTerminal(buf)
   call delete('XtestProp')
 endfunc
+
+func RunTestVisualBlock(width, dump)
+  call writefile([
+	\ "call setline(1, ["
+	\	.. "'xxxxxxxxx 123 x',"
+	\	.. "'xxxxxxxx 123 x',"
+	\	.. "'xxxxxxx 123 x',"
+	\	.. "'xxxxxx 123 x',"
+	\	.. "'xxxxx 123 x',"
+	\	.. "'xxxx 123 xx',"
+	\	.. "'xxx 123 xxx',"
+	\	.. "'xx 123 xxxx',"
+	\	.. "'x 123 xxxxx',"
+	\	.. "' 123 xxxxxx',"
+	\	.. "])",
+	\ "hi SearchProp ctermbg=yellow",
+	\ "call prop_type_add('search', {'highlight': 'SearchProp'})",
+	\ "call prop_add(1, 11, {'length': 3, 'type': 'search'})",
+	\ "call prop_add(2, 10, {'length': 3, 'type': 'search'})",
+	\ "call prop_add(3, 9, {'length': 3, 'type': 'search'})",
+	\ "call prop_add(4, 8, {'length': 3, 'type': 'search'})",
+	\ "call prop_add(5, 7, {'length': 3, 'type': 'search'})",
+	\ "call prop_add(6, 6, {'length': 3, 'type': 'search'})",
+	\ "call prop_add(7, 5, {'length': 3, 'type': 'search'})",
+	\ "call prop_add(8, 4, {'length': 3, 'type': 'search'})",
+	\ "call prop_add(9, 3, {'length': 3, 'type': 'search'})",
+	\ "call prop_add(10, 2, {'length': 3, 'type': 'search'})",
+	\ "normal 1G6|\<C-V>" .. repeat('l', a:width - 1) .. "10jx",
+	\], 'XtestPropVis')
+  let buf = RunVimInTerminal('-S XtestPropVis', {'rows': 12})
+  call VerifyScreenDump(buf, 'Test_textprop_vis_' .. a:dump, {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('XtestPropVis')
+endfunc
+
+" screenshot test with Visual block mode operations
+func Test_textprop_screenshot_visual()
+  if !CanRunVimInTerminal()
+    return
+  endif
+
+  " Delete two columns while text props are three chars wide.
+  call RunTestVisualBlock(2, '01')
+
+  " Same, but delete four columns
+  call RunTestVisualBlock(4, '02')
+endfunc