Fix #513
This commit is contained in:
@@ -319,14 +319,23 @@ core.confirm = function(self, e, option, callback)
|
|||||||
|
|
||||||
-- Restore the state again without modify the `.` register.
|
-- Restore the state again without modify the `.` register.
|
||||||
end, function(next)
|
end, function(next)
|
||||||
if api.is_cmdline_mode() then
|
|
||||||
local ctx = context.new()
|
local ctx = context.new()
|
||||||
|
if api.is_cmdline_mode() then
|
||||||
local keys = {}
|
local keys = {}
|
||||||
table.insert(keys, keymap.backspace(ctx.cursor.character - vim.str_utfindex(ctx.cursor_line, e:get_offset() - 1)))
|
table.insert(keys, keymap.backspace(ctx.cursor.character - vim.str_utfindex(ctx.cursor_line, e:get_offset() - 1)))
|
||||||
table.insert(keys, string.sub(e.context.cursor_before_line, e:get_offset()))
|
table.insert(keys, string.sub(e.context.cursor_before_line, e:get_offset()))
|
||||||
feedkeys.call(table.concat(keys, ''), 'nt', next)
|
feedkeys.call(table.concat(keys, ''), 'nt', next)
|
||||||
else
|
else
|
||||||
vim.api.nvim_set_current_line(e.context.cursor_line)
|
vim.api.nvim_buf_set_text(
|
||||||
|
0,
|
||||||
|
ctx.cursor.row - 1,
|
||||||
|
e:get_offset() - 1,
|
||||||
|
ctx.cursor.row - 1,
|
||||||
|
ctx.cursor.col - 1,
|
||||||
|
{
|
||||||
|
string.sub(e.context.cursor_before_line, e:get_offset())
|
||||||
|
}
|
||||||
|
)
|
||||||
vim.api.nvim_win_set_cursor(0, { e.context.cursor.row, e.context.cursor.col - 1 })
|
vim.api.nvim_win_set_cursor(0, { e.context.cursor.row, e.context.cursor.col - 1 })
|
||||||
next()
|
next()
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user