summaryrefslogtreecommitdiff
path: root/src/testdir/test_textprop.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-05-17 22:57:26 +0200
committerBram Moolenaar <Bram@vim.org>2019-05-17 22:57:26 +0200
commit8055d17388736421d875dd4933c4c93d49a2ab58 (patch)
tree81ebca77b3ed10b02f42f8513c29b838ac7952fb /src/testdir/test_textprop.vim
parent787880a86dbcb79cdf6e8241b1d99ac4a7acbc09 (diff)
downloadvim-git-8055d17388736421d875dd4933c4c93d49a2ab58.tar.gz
patch 8.1.1343: text properties not adjusted for Visual block mode deletev8.1.1343
Problem: Text properties not adjusted for Visual block mode delete. Solution: Call adjust_prop_columns(). (closes #4384)
Diffstat (limited to 'src/testdir/test_textprop.vim')
-rw-r--r--src/testdir/test_textprop.vim51
1 files changed, 50 insertions, 1 deletions
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 635902c7e..d1897a236 100644
--- 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