mirror of
https://github.com/zoriya/jj.nvim.git
synced 2026-08-05 10:46:08 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user