summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_textprop.vim
diff options
context:
space:
mode:
authorDylan Thacker-Smith <dylan.ah.smith@gmail.com>2024-03-24 09:43:25 +0100
committerChristian Brabandt <cb@256bit.org>2024-03-24 09:43:25 +0100
commitb2d124c6258ff41e1f951bf39a4afc386d79ddc4 (patch)
tree553f0db370d31fbdb8752e25aba51cb6cf70586b /src/testdir/test_textprop.vim
parentd3c0ff5d5a9076999a8504ee4d23a2c5abaf494e (diff)
patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text linesv9.1.0200
Problem: `gj`/`gk` was updating the desired cursor virtual column to the outer virtual text, even though the actual cursor position was moved to not be on the virtual text, leading the need to do an extra `gj`/`gk` to move past each virtual text line. (rickhowe) Solution: Exclude the outer virtual text when getting the line length for moving the cursor with `gj`/`gk`, so that no extra movement is needed to skip over virtual text lines. (Dylan Thacker-Smith) fixes: #12028 related: #14262 Signed-off-by: Dylan Thacker-Smith <dylan.ah.smith@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir/test_textprop.vim')
-rw-r--r--src/testdir/test_textprop.vim39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index a06f733706..a7057147d4 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -2690,6 +2690,45 @@ func Test_prop_inserts_text_normal_gj_gk()
call Run_test_prop_inserts_text_normal_gj_gk('set virtualedit=all')
endfunc
+func Test_prop_normal_gj_gk_over_outer_virtual_text()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ vim9script
+ setlocal number
+ setline(1, ['First line fits on screen line.', '', 'Third line fits on screen line.'])
+
+ var vt = 'test'
+ prop_type_add(vt, {highlight: 'ToDo'})
+ for ln in range(1, line('$'))
+ prop_add(ln, 0, {type: vt, text: 'Above', text_align: 'above'})
+ prop_add(ln, 0, {type: vt, text: 'After text wraps to next line.', text_align: 'after', text_wrap: 'wrap'})
+ prop_add(ln, 0, {type: vt, text: 'Right text wraps to next line.', text_align: 'right', text_wrap: 'wrap'})
+ prop_add(ln, 0, {type: vt, text: 'Below', text_align: 'below'})
+ endfor
+ normal 3l
+ END
+ call writefile(lines, 'XscriptPropsNormal_gj_gk_over_outer', 'D')
+ let buf = RunVimInTerminal('-S XscriptPropsNormal_gj_gk_over_outer', #{rows: 16, cols: 40})
+ call VerifyScreenDump(buf, 'Test_prop_normal_gj_gk_over_outer_virtual_text_1', {})
+
+ call term_sendkeys(buf, "gj")
+ call VerifyScreenDump(buf, 'Test_prop_normal_gj_gk_over_outer_virtual_text_2', {})
+ call term_sendkeys(buf, "gj")
+ call VerifyScreenDump(buf, 'Test_prop_normal_gj_gk_over_outer_virtual_text_3', {})
+ call term_sendkeys(buf, "gk")
+ call VerifyScreenDump(buf, 'Test_prop_normal_gj_gk_over_outer_virtual_text_2', {})
+ call term_sendkeys(buf, "gk")
+ call VerifyScreenDump(buf, 'Test_prop_normal_gj_gk_over_outer_virtual_text_1', {})
+
+ call term_sendkeys(buf, "2gj")
+ call VerifyScreenDump(buf, 'Test_prop_normal_gj_gk_over_outer_virtual_text_3', {})
+ call term_sendkeys(buf, "2gk")
+ call VerifyScreenDump(buf, 'Test_prop_normal_gj_gk_over_outer_virtual_text_1', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
func Test_prop_inserts_text_visual_block()
CheckRunVimInTerminal