fix(editor,terminal): Correctly restore log buffer and cursor position

A regresion was introduced by #81 where the log buffer was not being
    restored when there was no modification after describing from the
    log buffer. This has been reworked and now the function `on_done` is
    always called not only when there are lines in the buffer giving the
    responsibility to check the nilness on the `on_done` function.

    There was a bug also when restoring cursor position which was being
    wiped when the buffer was closed which is not actually what we want
This commit is contained in:
NicolasGB
2026-02-09 13:10:09 +01:00
parent 149ae9ebc7
commit 6a3ff64116
2 changed files with 1 additions and 4 deletions
+1 -3
View File
@@ -155,9 +155,7 @@ function M.open_editor(initial_text, on_write, on_unload, keymaps)
buffer = buf,
callback = function()
local last_written = vim.b[buf].jj_last_written_lines
if last_written then
on_unload(last_written)
end
on_unload(last_written)
end,
})
end
-1
View File
@@ -148,7 +148,6 @@ function M.close_terminal_buffer()
-- Otherwise close the buffer
buffer.close(state.buf)
state.buf_cmd = nil
state.cursor_restore_pos = nil
state.chan = nil
state.job_id = nil
end