mirror of
https://github.com/neovim/neovim.git
synced 2026-08-28 10:01:49 +00:00
fix(prompt): ensure prompt-mark col gets reseted properly #37669
problem: currently when empty string is set as prompt the prompt-mark column doesn't update. solution: ensure the column is reset to 0 when starting prompt buffer and before creating a new prompt after prompt-callback.
This commit is contained in:
@@ -762,4 +762,35 @@ describe('prompt buffer', function()
|
||||
{5:-- INSERT --} |
|
||||
]])
|
||||
end)
|
||||
|
||||
it('works correctly with empty string as prompt', function()
|
||||
api.nvim_set_option_value('buftype', 'prompt', { buf = 0 })
|
||||
exec_lua(function()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
vim.fn.prompt_setprompt(buf, '')
|
||||
end)
|
||||
|
||||
source('startinsert')
|
||||
|
||||
-- mark correctly set
|
||||
eq({ 1, 0 }, api.nvim_buf_get_mark(0, ':'))
|
||||
|
||||
feed('asdf')
|
||||
screen:expect([[
|
||||
asdf^ |
|
||||
{1:~ }|*8
|
||||
{5:-- INSERT --} |
|
||||
]])
|
||||
|
||||
-- can clear all of it
|
||||
feed('<backspace><backspace><backspace><backspace>')
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*8
|
||||
{5:-- INSERT --} |
|
||||
]])
|
||||
feed('<cr>')
|
||||
|
||||
eq({ 2, 0 }, api.nvim_buf_get_mark(0, ':'))
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user