mirror of
https://github.com/zoriya/jj.nvim.git
synced 2026-08-05 10:46:08 +00:00
fix: describe command reopening log buffer without flicker
- Close terminal buffer before opening describe editor - Capture log state before closing to detect if we should reopen - Add on_unload callback to editor to handle log reopening - Suppress redraws during buffer transitions with lazyredraw - Remove duplicate hardcoded status keymaps from terminal.lua (were referencing undefined functions) - Fix resolve_keymaps_from_specs to validate handlers exist before creating keymaps
This commit is contained in:
+12
-1
@@ -51,8 +51,9 @@ end
|
||||
|
||||
---@param initial_text string[] Lines to initialize the buffer with
|
||||
---@param on_done fun(buf: string[])? Optional callback called with user text on buffer write
|
||||
---@param on_unload? fun()? Optional callback called when the buffer is closed
|
||||
---@param keymaps? jj.core.buffer.keymap[] Optional keymaps for the buffer
|
||||
function M.open_editor(initial_text, on_done, keymaps)
|
||||
function M.open_editor(initial_text, on_done, on_unload, keymaps)
|
||||
-- Initialize highlight groups once
|
||||
init_highlights()
|
||||
|
||||
@@ -156,6 +157,16 @@ function M.open_editor(initial_text, on_done, keymaps)
|
||||
vim.bo[buf].modified = false
|
||||
end,
|
||||
})
|
||||
|
||||
-- Register the on_close callback
|
||||
if on_unload then
|
||||
vim.api.nvim_create_autocmd("BufWipeout", {
|
||||
buffer = buf,
|
||||
callback = function()
|
||||
on_unload()
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user