From f3511cb4b3bcd11955a473ebf03fff2dcd45654a Mon Sep 17 00:00:00 2001 From: Wonung Kim Date: Mon, 23 Feb 2026 18:11:20 +0900 Subject: [PATCH] feat: refresh buffers when moving the change (#92) --- lua/jj/cmd/init.lua | 1 + lua/jj/cmd/log.lua | 3 +++ lua/jj/picker/snacks.lua | 1 + lua/jj/utils.lua | 5 +++++ 4 files changed, 10 insertions(+) diff --git a/lua/jj/cmd/init.lua b/lua/jj/cmd/init.lua index 28e6f4f..f49523d 100644 --- a/lua/jj/cmd/init.lua +++ b/lua/jj/cmd/init.lua @@ -370,6 +370,7 @@ function M.edit() }, function(input) if input then runner.execute_command_async(string.format("jj edit %s", input), function() + utils.reload_changed_file_buffers() M.log({}) end, "Error editing change") else diff --git a/lua/jj/cmd/log.lua b/lua/jj/cmd/log.lua index 119d24a..dd68280 100644 --- a/lua/jj/cmd/log.lua +++ b/lua/jj/cmd/log.lua @@ -408,6 +408,8 @@ function M.handle_log_edit(ignore_immut, close_on_exit) -- Try to execute cmd runner.execute_command_async(cmd, function() + utils.reload_changed_file_buffers() + -- Close the terminal buffer if close_on_exit then utils.notify(string.format("Editing change: `%s`", revset), vim.log.levels.INFO) @@ -828,6 +830,7 @@ function M.handle_summary_edit(revset, ignore_immut) end runner.execute_command_async(cmd, function() + utils.reload_changed_file_buffers() utils.notify(string.format("Editing revset: `%s`", revset), vim.log.levels.INFO) -- Open the file in the current window vim.cmd("edit " .. vim.fn.fnameescape(filepath.new_path)) diff --git a/lua/jj/picker/snacks.lua b/lua/jj/picker/snacks.lua index 6c3944e..3dc80cf 100644 --- a/lua/jj/picker/snacks.lua +++ b/lua/jj/picker/snacks.lua @@ -149,6 +149,7 @@ function M.file_log_history(opts, log_lines) ) if ok then + utils.reload_changed_file_buffers() utils.notify(string.format("Editing revision `%s`", item.rev), vim.log.levels.INFO) end end, diff --git a/lua/jj/utils.lua b/lua/jj/utils.lua index 0eb8fb4..dde0110 100644 --- a/lua/jj/utils.lua +++ b/lua/jj/utils.lua @@ -690,4 +690,9 @@ function M.extract_description_from_describe(lines) return trimmed_description end +--- Reload loaded file buffers after working-copy changes. +function M.reload_changed_file_buffers() + vim.cmd.checktime() +end + return M