aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorluukvbaal <luukvbaal@gmail.com>2024-07-17 02:53:10 +0200
committerGitHub <noreply@github.com>2024-07-17 08:53:10 +0800
commitf9a49fab0c9062cb0e5ed8fbb26579efda0e7a30 (patch)
tree4f25d544c354b48a1d591c004051571b28ae3e56 /test
parent1f2f460b4a77a8ff58872e03c071b5d0d882dd44 (diff)
downloadrneovim-f9a49fab0c9062cb0e5ed8fbb26579efda0e7a30.tar.gz
rneovim-f9a49fab0c9062cb0e5ed8fbb26579efda0e7a30.tar.bz2
rneovim-f9a49fab0c9062cb0e5ed8fbb26579efda0e7a30.zip
fix(column): modifying a sign should update placed signs (#29750)
Problem: Modifying a sign no longer updates already placed signs. Solution: Loop over (newly-exposed) placed decorations when modifying a sign definition. Update placed decor if it belongs to the sign that is modified.
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/signs_spec.lua50
1 files changed, 47 insertions, 3 deletions
diff --git a/test/functional/legacy/signs_spec.lua b/test/functional/legacy/signs_spec.lua
index 614673ee3c..61eba1e559 100644
--- a/test/functional/legacy/signs_spec.lua
+++ b/test/functional/legacy/signs_spec.lua
@@ -1,13 +1,14 @@
-- Tests for signs
local n = require('test.functional.testnvim')()
+local Screen = require('test.functional.ui.screen')
-local clear, command, expect = n.clear, n.command, n.expect
+local clear, command, exec, expect, feed = n.clear, n.command, n.exec, n.expect, n.feed
describe('signs', function()
- setup(clear)
+ before_each(clear)
- it('is working', function()
+ it('are working', function()
command('sign define JumpSign text=x')
command([[exe 'sign place 42 line=2 name=JumpSign buffer=' . bufnr('')]])
-- Split the window to the bottom to verify :sign-jump will stay in the current
@@ -21,4 +22,47 @@ describe('signs', function()
2]])
end)
+
+ -- oldtest: Test_sign_cursor_position()
+ it('are drawn correctly', function()
+ local screen = Screen.new(75, 6)
+ screen:attach()
+ exec([[
+ call setline(1, [repeat('x', 75), 'mmmm', 'yyyy'])
+ call cursor(2,1)
+ sign define s1 texthl=Search text==>
+ redraw
+ sign place 10 line=2 name=s1
+ ]])
+ screen:expect([[
+ {7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
+ {7: }xx |
+ {10:=>}^mmmm |
+ {7: }yyyy |
+ {1:~ }|
+ |
+ ]])
+
+ -- Change the sign text
+ command('sign define s1 text=-)')
+ screen:expect([[
+ {7: }xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
+ {7: }xx |
+ {10:-)}^mmmm |
+ {7: }yyyy |
+ {1:~ }|
+ |
+ ]])
+
+ -- update cursor position calculation
+ feed('lh')
+ command('sign unplace 10')
+ screen:expect([[
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
+ ^mmmm |
+ yyyy |
+ {1:~ }|*2
+ |
+ ]])
+ end)
end)