changeset 32872:7a1a9ce831c3 v9.0.1745

patch 9.0.1745: Missing test coverage for blockwise Visual highlight Commit: https://github.com/vim/vim/commit/fc3058495d3ff58c8f2b9dd4452d0840f2d1fa42 Author: zeertzjq <zeertzjq@outlook.com> Date: Sat Aug 19 13:27:03 2023 +0200 patch 9.0.1745: Missing test coverage for blockwise Visual highlight Problem: Missing test coverage for blockwise Visual highlight with virtual that starts with a double-width char. Solution: Add a new virtual text to the test. Some other small fixes. closes: #12835 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author Christian Brabandt <cb@256bit.org>
date Sat, 19 Aug 2023 13:30:08 +0200
parents 7d5daefc6bb6
children ebda645f56be
files src/dict.c src/testdir/dumps/Test_prop_inserts_text_visual_block_1.dump src/testdir/dumps/Test_prop_inserts_text_visual_block_2.dump src/testdir/dumps/Test_prop_inserts_text_visual_block_3.dump src/testdir/dumps/Test_prop_inserts_text_visual_block_4.dump src/testdir/dumps/Test_prop_inserts_text_visual_block_5.dump src/testdir/dumps/Test_prop_inserts_text_visual_block_6.dump src/testdir/dumps/Test_prop_inserts_text_visual_block_7.dump src/testdir/test_conceal.vim src/testdir/test_highlight.vim src/testdir/test_textprop.vim src/version.c
diffstat 12 files changed, 30 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/dict.c
+++ b/src/dict.c
@@ -1497,7 +1497,7 @@ dict2list(typval_T *argvars, typval_T *r
 
     d = argvars[0].vval.v_dict;
     if (d == NULL)
-	// empty dict behaves like an empty dict
+	// NULL dict behaves like an empty dict
 	return;
 
     todo = (int)d->dv_hashtab.ht_used;
--- a/src/testdir/dumps/Test_prop_inserts_text_visual_block_1.dump
+++ b/src/testdir/dumps/Test_prop_inserts_text_visual_block_1.dump
@@ -1,6 +1,6 @@
 >1+0&#ffffff0|2|3|4|5|6|7|8|9| @50
 |1|-+0#e000e06&|口*&|-+&|2+0#0000000&|3|4|5|6|7|8|9| @46
+|1|2|口*0#e000e06&|3+0#0000000&|4|5|6|7|8|9| @48
 |1|2|3|4|5|6|7|8|9| @50
 |~+0#4040ff13&| @58
-|~| @58
 | +0#0000000&@41|1|,|1| @10|A|l@1| 
--- a/src/testdir/dumps/Test_prop_inserts_text_visual_block_2.dump
+++ b/src/testdir/dumps/Test_prop_inserts_text_visual_block_2.dump
@@ -1,6 +1,6 @@
 |1+0&#e0e0e08|2|3+0&#ffffff0|4|5|6|7|8|9| @50
 |1+0&#e0e0e08|-+0#e000e06#ffffff0|口*&|-+&|2+0#0000000&|3|4|5|6|7|8|9| @46
+|1+0&#e0e0e08|2|口*0#e000e06#ffffff0|3+0#0000000&|4|5|6|7|8|9| @48
 |1+0&#e0e0e08>2+0&#ffffff0|3|4|5|6|7|8|9| @50
 |~+0#4040ff13&| @58
-|~| @58
-|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@13|3|x|2| @6|3|,|2| @10|A|l@1| 
+|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@13|4|x|2| @6|4|,|2| @10|A|l@1| 
--- a/src/testdir/dumps/Test_prop_inserts_text_visual_block_3.dump
+++ b/src/testdir/dumps/Test_prop_inserts_text_visual_block_3.dump
@@ -1,6 +1,6 @@
 |1+0&#e0e0e08|2|3|4+0&#ffffff0|5|6|7|8|9| @50
 |1+0&#e0e0e08|-+0#e000e06#ffffff0|口*&|-+&|2+0#0000000&|3|4|5|6|7|8|9| @46
+|1+0&#e0e0e08|2|口*0#e000e06#ffffff0|3+0#0000000&|4|5|6|7|8|9| @48
 |1+0&#e0e0e08|2>3+0&#ffffff0|4|5|6|7|8|9| @50
 |~+0#4040ff13&| @58
-|~| @58
-|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@13|3|x|3| @6|3|,|3| @10|A|l@1| 
+|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@13|4|x|3| @6|4|,|3| @10|A|l@1| 
--- a/src/testdir/dumps/Test_prop_inserts_text_visual_block_4.dump
+++ b/src/testdir/dumps/Test_prop_inserts_text_visual_block_4.dump
@@ -1,6 +1,6 @@
 |1+0&#e0e0e08|2|3|4|5|6|7|8+0&#ffffff0|9| @50
 |1+0&#e0e0e08|-+0#e000e06#ffffff0|口*&|-+&|2+0#0000000#e0e0e08|3|4+0&#ffffff0|5|6|7|8|9| @46
+|1+0&#e0e0e08|2|口*0#e000e06#ffffff0|3+0#0000000#e0e0e08|4|5|6+0&#ffffff0|7|8|9| @48
 |1+0&#e0e0e08|2|3|4|5|6>7+0&#ffffff0|8|9| @50
 |~+0#4040ff13&| @58
-|~| @58
-|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@13|3|x|7| @6|3|,|7| @10|A|l@1| 
+|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@13|4|x|7| @6|4|,|7| @10|A|l@1| 
--- a/src/testdir/dumps/Test_prop_inserts_text_visual_block_5.dump
+++ b/src/testdir/dumps/Test_prop_inserts_text_visual_block_5.dump
@@ -1,6 +1,6 @@
 |1+0&#ffffff0|2+0&#e0e0e08|3|4|5|6|7|8+0&#ffffff0|9| @50
 |1|-+0#e000e06&|口*&|-+&|2+0#0000000#e0e0e08|3|4+0&#ffffff0|5|6|7|8|9| @46
+|1|2+0&#e0e0e08|口*0#e000e06#ffffff0|3+0#0000000#e0e0e08|4|5|6+0&#ffffff0|7|8|9| @48
 |1>2|3+0&#e0e0e08|4|5|6|7|8+0&#ffffff0|9| @50
 |~+0#4040ff13&| @58
-|~| @58
-|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@13|3|x|6| @6|3|,|2| @10|A|l@1| 
+|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@13|4|x|6| @6|4|,|2| @10|A|l@1| 
--- a/src/testdir/dumps/Test_prop_inserts_text_visual_block_6.dump
+++ b/src/testdir/dumps/Test_prop_inserts_text_visual_block_6.dump
@@ -1,6 +1,6 @@
 |1+0&#ffffff0|2|3+0&#e0e0e08|4|5|6|7|8+0&#ffffff0|9| @50
 |1|-+0#e000e06&|口*&|-+&|2+0#0000000#e0e0e08|3|4+0&#ffffff0|5|6|7|8|9| @46
+|1|2|口*0#e000e06&|3+0#0000000#e0e0e08|4|5|6+0&#ffffff0|7|8|9| @48
 |1|2>3|4+0&#e0e0e08|5|6|7|8+0&#ffffff0|9| @50
 |~+0#4040ff13&| @58
-|~| @58
-|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@13|3|x|5| @6|3|,|3| @10|A|l@1| 
+|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@13|4|x|5| @6|4|,|3| @10|A|l@1| 
--- a/src/testdir/dumps/Test_prop_inserts_text_visual_block_7.dump
+++ b/src/testdir/dumps/Test_prop_inserts_text_visual_block_7.dump
@@ -1,6 +1,6 @@
 |1+0&#ffffff0|2|3|4+0&#e0e0e08|5|6|7|8+0&#ffffff0|9| @50
 |1|-+0#e000e06&|口*&|-+&|2+0#0000000#e0e0e08|3|4+0&#ffffff0|5|6|7|8|9| @46
+|1|2|口*0#e000e06&|3+0#0000000#e0e0e08|4|5|6+0&#ffffff0|7|8|9| @48
 |1|2|3>4|5+0&#e0e0e08|6|7|8+0&#ffffff0|9| @50
 |~+0#4040ff13&| @58
-|~| @58
-|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@13|3|x|4| @6|3|,|4| @10|A|l@1| 
+|-+2#0000000&@1| |V|I|S|U|A|L| |B|L|O|C|K| |-@1| +0&&@13|4|x|4| @6|4|,|4| @10|A|l@1| 
--- a/src/testdir/test_conceal.vim
+++ b/src/testdir/test_conceal.vim
@@ -347,6 +347,10 @@ func Test_conceal_mouse_click()
   redraw
   call assert_equal(['conceal  click here '], ScreenLines(1, 20))
 
+  " click on the space between "this" and "click" puts cursor there
+  call test_setmouse(1, 9)
+  call feedkeys("\<LeftMouse>", "tx")
+  call assert_equal([0, 1, 13, 0, 13], getcurpos())
   " click on 'h' of "here" puts cursor there
   call test_setmouse(1, 16)
   call feedkeys("\<LeftMouse>", "tx")
@@ -373,6 +377,11 @@ func Test_conceal_mouse_click()
   call assert_equal([0, 1, 23, 0, 36], getcurpos())
 
   set virtualedit=all
+  redraw
+  " click on the space between "this" and "click" puts cursor there
+  call test_setmouse(1, 9)
+  call feedkeys("\<LeftMouse>", "tx")
+  call assert_equal([0, 1, 13, 0, 13], getcurpos())
   " click on 'h' of "here" puts cursor there
   call test_setmouse(1, 16)
   call feedkeys("\<LeftMouse>", "tx")
--- a/src/testdir/test_highlight.vim
+++ b/src/testdir/test_highlight.vim
@@ -744,8 +744,8 @@ func Test_colorcolumn_sbr()
   let lines =<< trim END
 	call setline(1, 'The quick brown fox jumped over the lazy dogs')
   END
-  call writefile(lines, 'Xtest_colorcolumn_srb', 'D')
-  let buf = RunVimInTerminal('-S Xtest_colorcolumn_srb', {'rows': 10,'columns': 40})
+  call writefile(lines, 'Xtest_colorcolumn_sbr', 'D')
+  let buf = RunVimInTerminal('-S Xtest_colorcolumn_sbr', {'rows': 10,'columns': 40})
   call term_sendkeys(buf, ":set co=40 showbreak=+++>\\  cc=40,41,43\<CR>")
   call VerifyScreenDump(buf, 'Test_colorcolumn_3', {})
 
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -2606,14 +2606,15 @@ func Test_prop_inserts_text_visual_block
   CheckRunVimInTerminal
 
   let lines =<< trim END
-    call setline(1, repeat(['123456789'], 3))
+    call setline(1, repeat(['123456789'], 4))
     call prop_type_add('theprop', #{highlight: 'Special'})
     call prop_add(2, 2, {'type': 'theprop', 'text': '-口-'})
+    call prop_add(3, 3, {'type': 'theprop', 'text': '口'})
   END
   call writefile(lines, 'XscriptPropsVisualBlock', 'D')
   let buf = RunVimInTerminal('-S XscriptPropsVisualBlock', #{rows: 6, cols: 60})
   call VerifyScreenDump(buf, 'Test_prop_inserts_text_visual_block_1', {})
-  call term_sendkeys(buf, "\<C-V>2jl")
+  call term_sendkeys(buf, "\<C-V>3jl")
   call VerifyScreenDump(buf, 'Test_prop_inserts_text_visual_block_2', {})
   call term_sendkeys(buf, "l")
   call VerifyScreenDump(buf, 'Test_prop_inserts_text_visual_block_3', {})
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1745,
+/**/
     1744,
 /**/
     1743,