aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/buffer_updates_spec.lua
diff options
context:
space:
mode:
authorSean Dewar <6256228+seandewar@users.noreply.github.com>2026-02-15 17:02:40 +0000
committerSean Dewar <6256228+seandewar@users.noreply.github.com>2026-02-15 23:42:10 +0000
commit51dc752e6cfaee5f76424b16c4c48bd4915bbffb (patch)
treefeab271c1b4fcc50d8db61170a9f96b92adb6543 /test/functional/lua/buffer_updates_spec.lua
parent3a10405214ace2ac4bf7a289bd789fa16e18c437 (diff)
downloadrneovim-51dc752e6cfaee5f76424b16c4c48bd4915bbffb.tar.gz
rneovim-51dc752e6cfaee5f76424b16c4c48bd4915bbffb.tar.bz2
rneovim-51dc752e6cfaee5f76424b16c4c48bd4915bbffb.zip
fix(prompt): wrong changed lnum in init_prompt
Problem: if init_prompt replaces the prompt line at the ': mark, it calls inserted_bytes with the wrong lnum. Solution: use the correct lnum. Call appended_lines_mark instead when appending the prompt at the end.
Diffstat (limited to 'test/functional/lua/buffer_updates_spec.lua')
-rw-r--r--test/functional/lua/buffer_updates_spec.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua
index e884499a98..e87407f176 100644
--- a/test/functional/lua/buffer_updates_spec.lua
+++ b/test/functional/lua/buffer_updates_spec.lua
@@ -463,6 +463,14 @@ describe('lua: nvim_buf_attach on_lines', function()
{ 'test1', 'lines', 1, 12, 0, 1, 1, 16 },
}
eq({ 'foo > hello', 'there' }, api.nvim_buf_get_lines(0, 0, -1, true))
+
+ -- init_prompt uses appended_lines_mark when appending to fix prompt.
+ api.nvim_buf_set_lines(0, 0, -1, true, { 'hi' })
+ eq({ 'hi', 'foo > ' }, api.nvim_buf_get_lines(0, 0, -1, true))
+ check_events {
+ { 'test1', 'lines', 1, 13, 0, 2, 1, 18 },
+ { 'test1', 'lines', 1, 14, 1, 1, 2, 0 },
+ }
end)
end)
@@ -1652,6 +1660,14 @@ describe('lua: nvim_buf_attach on_bytes', function()
{ 'test1', 'bytes', 1, 15, 2, 0, 6, 0, 10, 10, 0, 7, 7 },
}
eq({ '% ', '% ', 'cool > sup', 'dood' }, api.nvim_buf_get_lines(0, 0, -1, true))
+
+ -- init_prompt uses appended_lines_mark when appending to fix prompt.
+ api.nvim_buf_set_lines(0, 0, -1, true, { 'hi' })
+ eq({ 'hi', 'cool > ' }, api.nvim_buf_get_lines(0, 0, -1, true))
+ check_events {
+ { 'test1', 'bytes', 1, 16, 0, 0, 0, 4, 0, 22, 1, 0, 3 },
+ { 'test1', 'bytes', 1, 17, 1, 0, 3, 0, 0, 0, 1, 0, 8 },
+ }
end)
local function test_lockmarks(mode)