Closed GordianDziwis closed 2 months ago
Ok, I have found the issue. Mcancel
does not add a new line with ======
, so Mchat
gets confused. A workaround is, to add in mchat.lua
in ftplugin
local function runOrEscape()
local status, err = pcall(vim.cmd, 'Mcancel')
vim.notify(vim.inspect(status))
if status then
local lastLine = vim.api.nvim_buf_line_count(0)
vim.api.nvim_buf_set_lines(0, lastLine, lastLine, false, { "", "======", "", "" })
vim.api.nvim_win_set_cursor(0, { lastLine + 4, 0 })
else
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<esc>', true, false, true), 'n', false)
end
end
vim.keymap.set('n', '<esc>', runOrEscape, { noremap = true, silent = true, buffer = true })
Hi! I'm not sure if I've understood correctly but this may be related to (or fixed by) #57 - is the issue just the half-completed assistant response? That PR should make partial assistant responses work correctly when continuing.
When aborting a completion with
Mcancel
the request continues in the background, so that onMchat
the old request will be inserted.Mcancel
-> Now the highlight changed and no text is insertedMchat
and prompt anything -> The first prompt is inserted