diff options
author | Ibby <33922797+SleepySwords@users.noreply.github.com> | 2023-03-28 01:23:21 +1100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2023-05-22 13:49:42 +0200 |
commit | be273c3a23cf65665e843cfb13fd5319657cc5c2 (patch) | |
tree | 7a253bea0c911ab5a90a5da098a1d8f6f02dd760 /test/functional/ui | |
parent | c5bf838f8aa51709f8d7ee81cf2b2a6479c77ad7 (diff) | |
download | rneovim-be273c3a23cf65665e843cfb13fd5319657cc5c2.tar.gz rneovim-be273c3a23cf65665e843cfb13fd5319657cc5c2.tar.bz2 rneovim-be273c3a23cf65665e843cfb13fd5319657cc5c2.zip |
vim-patch:9.0.0205: cursor in wrong position when inserting after virtual text
Problem: Cursor in wrong position when inserting after virtual text. (Ben
Jackson)
Solution: Put the cursor after the virtual text, where the text will be
inserted. (closes vim/vim#10914)
https://github.com/vim/vim/commit/28c9f895716cfa8f1220bc41b72a534c0e10cabe
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'test/functional/ui')
-rw-r--r-- | test/functional/ui/decorations_spec.lua | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index fa492dfcac..de3f7e7a5b 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -1652,11 +1652,12 @@ bbbbbbb]]) ]]} end) + feed('8l') it('visual select highlight is correct with virtual text attatched to', function() insert('foo foo foo foo') feed('0') meths.buf_set_extmark(0, ns, 0, 8, - { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) + { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline' }) feed('8l') screen:expect { grid = [[ foo foo {28:virtual text}^foo foo | @@ -1696,6 +1697,50 @@ bbbbbbb]]) {24:-- VISUAL --} | ]]} end) + + it('cursor position is correct when inserting around a virtual text with right gravity set to false', function() + insert('foo foo foo foo') + meths.buf_set_extmark(0, ns, 0, 8, + { virt_text = { { 'virtual text', 'Special' } }, virt_text_pos = 'inline', right_gravity = false }) + feed('0') + feed('8l') + screen:expect { grid = [[ + foo foo {28:virtual text}^foo foo | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]} + + feed('i') + screen:expect { grid = [[ + foo foo {28:virtual text}^foo foo | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {24:-- INSERT --} | + ]]} + end) end) describe('decorations: virtual lines', function() |