From 6a3ff64116a58e00cada0b1a666ada7126a70f4b Mon Sep 17 00:00:00 2001 From: NicolasGB Date: Mon, 9 Feb 2026 11:34:20 +0100 Subject: [PATCH] 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 --- lua/jj/ui/editor.lua | 4 +--- lua/jj/ui/terminal.lua | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lua/jj/ui/editor.lua b/lua/jj/ui/editor.lua index 08d1336..475d797 100644 --- a/lua/jj/ui/editor.lua +++ b/lua/jj/ui/editor.lua @@ -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 diff --git a/lua/jj/ui/terminal.lua b/lua/jj/ui/terminal.lua index cb5f310..8722bb9 100644 --- a/lua/jj/ui/terminal.lua +++ b/lua/jj/ui/terminal.lua @@ -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