mirror of
https://github.com/zoriya/jj.nvim.git
synced 2026-08-15 23:53:18 +00:00
feat!(terminal): unify terminal window behavior and centralize sizing config (#102)
- add terminal.window.type support (hsplit, vsplit, floating, tab) - add terminal.window.split_size for split-based layouts - rename floating size options to terminal.window.floating_width/floating_height - validate terminal window ratios during setup - make terminal.run/run_floating merge default keymaps internally - remove cmd.split width/height sizing in favor of terminal.window config - improve floating/log buffer state handling and refresh behavior - update README examples and configuration docs BREAKING CHANGE: terminal sizing/config moved to terminal.window.*. Removed cmd.split.width/cmd.split.height. Renamed terminal.window.width/height to terminal.window.floating_width/floating_height
This commit is contained in:
+11
-3
@@ -334,7 +334,7 @@ function M.log(opts)
|
||||
end
|
||||
|
||||
-- If a log was already being displayed before this command we will want to maintain the cursor position
|
||||
if terminal.state.buf_cmd == "log" then
|
||||
if terminal.is_log_buffer_open() then
|
||||
terminal.store_cursor_position()
|
||||
-- Make sure to clear highlights before rerunning since the previous log buffer might have some
|
||||
vim.api.nvim_buf_clear_namespace(terminal.state.buf, log_selected_ns_id, 0, -1)
|
||||
@@ -856,9 +856,17 @@ function M.handle_log_split()
|
||||
on_exit = function(exit_code)
|
||||
if exit_code == 0 then
|
||||
utils.notify(string.format("Successfully split `%s`", revset), vim.log.levels.INFO)
|
||||
M.log({})
|
||||
vim.schedule(function()
|
||||
M.log({})
|
||||
end)
|
||||
else
|
||||
utils.notify(string.format("Cancelled splitting `%s`", revset), vim.log.levels.WARN)
|
||||
-- Since we previously replaced the floating with the split we actually want to re run the log cmd
|
||||
if require("jj").config.terminal.window.type == "floating" then
|
||||
vim.schedule(function()
|
||||
M.log({})
|
||||
end)
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
@@ -1197,7 +1205,7 @@ function M.log_keymaps()
|
||||
desc = "Change the revset(s) being viewed",
|
||||
handler = M.handle_log_change_revset,
|
||||
modes = { "n", "v" },
|
||||
},
|
||||
},
|
||||
select_next_revision = {
|
||||
desc = "Move cursor to the next revision",
|
||||
handler = M.handle_log_select_next_revision,
|
||||
|
||||
Reference in New Issue
Block a user