summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_textprop.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-27 11:17:39 +0200
committerChristian Brabandt <cb@256bit.org>2023-08-27 11:17:39 +0200
commitd809c0a90387a23aed21ba37d0b65332fb5dafe7 (patch)
tree2d1e407ab6d503b26fdd1adce5a3b86a4e5c7156 /src/testdir/test_textprop.vim
parent58f39d89a8adff51ab04893d1fd28e3767979f9f (diff)
patch 9.0.1792: problem with gj/gk/gM and virtual textv9.0.1792
Problem: Normal mode "gM", "gj", "gk" commands behave incorrectly with virtual text. Solution: Use linetabsize() instead of linetabsize_str(). closes: #12909 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Diffstat (limited to 'src/testdir/test_textprop.vim')
-rw-r--r--src/testdir/test_textprop.vim51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 05bba61644..93baa7a7ed 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -2602,6 +2602,57 @@ func Test_prop_inserts_text_highlight()
call StopVimInTerminal(buf)
endfunc
+func Test_prop_inserts_text_normal_gM()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ call setline(1, '123456789')
+ call prop_type_add('theprop', #{highlight: 'Special'})
+ call prop_add(1, 3, {'type': 'theprop', 'text': 'bbb'})
+ call prop_add(1, 8, {'type': 'theprop', 'text': 'bbb'})
+ END
+ call writefile(lines, 'XscriptPropsNormal_gM', 'D')
+ let buf = RunVimInTerminal('-S XscriptPropsNormal_gM', #{rows: 3, cols: 60})
+ call term_sendkeys(buf, "gM")
+ call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gM', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
+func Run_test_prop_inserts_text_normal_gj_gk(cmd)
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ call setline(1, repeat([repeat('a', 55)], 2))
+ call prop_type_add('theprop', {})
+ call prop_add(1, 41, {'type': 'theprop', 'text': repeat('b', 10)})
+ call prop_add(2, 41, {'type': 'theprop', 'text': repeat('b', 10)})
+ END
+ let lines = insert(lines, a:cmd)
+ call writefile(lines, 'XscriptPropsNormal_gj_gk', 'D')
+ let buf = RunVimInTerminal('-S XscriptPropsNormal_gj_gk', #{rows: 6, cols: 60})
+ call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gj_gk_1', {})
+ call term_sendkeys(buf, "gj")
+ call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gj_gk_2', {})
+ call term_sendkeys(buf, "gj")
+ call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gj_gk_3', {})
+ call term_sendkeys(buf, "gj")
+ call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gj_gk_4', {})
+ call term_sendkeys(buf, "gk")
+ call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gj_gk_5', {})
+ call term_sendkeys(buf, "gk")
+ call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gj_gk_6', {})
+ call term_sendkeys(buf, "gk")
+ call VerifyScreenDump(buf, 'Test_prop_inserts_text_normal_gj_gk_7', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
+func Test_prop_inserts_text_normal_gj_gk()
+ call Run_test_prop_inserts_text_normal_gj_gk('')
+ call Run_test_prop_inserts_text_normal_gj_gk('set virtualedit=all')
+endfunc
+
func Test_prop_inserts_text_visual_block()
CheckRunVimInTerminal