From a78fd18ed92d7474d10b5640dcf7a15728d2e03a Mon Sep 17 00:00:00 2001 From: bfredl Date: Tue, 9 May 2023 14:26:03 +0200 Subject: fix(extmark): fix cursor position with both left and right gravity inline text --- test/functional/ui/decorations_spec.lua | 43 +++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'test') diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index f67c4be419..e8847258f4 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -1745,6 +1745,49 @@ bbbbbbb]]) ]]} end) + it('cursor position is correct when inserting around virtual texts with both left and right gravity ', function() + insert('foo foo foo foo') + meths.buf_set_extmark(0, ns, 0, 8, { virt_text = {{ '>>', 'Special' }}, virt_text_pos = 'inline', right_gravity = false }) + meths.buf_set_extmark(0, ns, 0, 8, { virt_text = {{ '<<', 'Special' }}, virt_text_pos = 'inline', right_gravity = true }) + feed('08l') + screen:expect{ grid = [[ + foo foo {28:>><<}^foo foo | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]} + + feed('i') + screen:expect { grid = [[ + foo foo {28:>>^<<}foo foo | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {24:-- INSERT --} | + ]]} + end) + it('draws correctly with no wrap multiple virtual text, where one is hidden', function() insert('abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz') command("set nowrap") -- cgit