From f180d25479d69d502c5794ec368a7bde86c57c95 Mon Sep 17 00:00:00 2001 From: Aidan De Angelis Date: Thu, 19 Mar 2026 04:36:25 -0700 Subject: [PATCH] feat(explorer): support position = "right" split.lua already maps "right" correctly and handles width vs height for it. layout.lua was the one gap: arrange() only checked for "left" before calling set_width, so "right" fell through to set_height. Adds "right" to the width checks in arrange() (3 sites) and updates the config comments to document the option. --- lua/codediff/config.lua | 4 ++-- lua/codediff/ui/layout.lua | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/codediff/config.lua b/lua/codediff/config.lua index da6fb325..5e91eed5 100644 --- a/lua/codediff/config.lua +++ b/lua/codediff/config.lua @@ -48,7 +48,7 @@ M.defaults = { -- Explorer panel configuration explorer = { - position = "left", -- "left" or "bottom" + position = "left", -- "left", "right", or "bottom" width = 40, -- Width when position is "left" (columns) height = 15, -- Height when position is "bottom" (lines) view_mode = "list", -- "list" (flat file list) or "tree" (directory tree) @@ -72,7 +72,7 @@ M.defaults = { -- History panel configuration (for :CodeDiff history) history = { - position = "bottom", -- "left" or "bottom" (default: bottom) + position = "bottom", -- "left", "right", or "bottom" (default: bottom) width = 40, -- Width when position is "left" (columns) height = 15, -- Height when position is "bottom" (lines) initial_focus = "history", -- Initial focus: "history", "original", or "modified" diff --git a/lua/codediff/ui/layout.lua b/lua/codediff/ui/layout.lua index d2c469f2..afb8bbec 100644 --- a/lua/codediff/ui/layout.lua +++ b/lua/codediff/ui/layout.lua @@ -35,7 +35,7 @@ function M.arrange(tabpage) -- Step 1: Pin panel size (fixed element) if panel_visible then - if panel_position == "left" then + if panel_position == "left" or panel_position == "right" then vim.api.nvim_win_set_width(panel_win, panel_config.width) else vim.api.nvim_win_set_height(panel_win, panel_config.height) @@ -51,7 +51,7 @@ function M.arrange(tabpage) local sole_win = orig_valid and original_win or (mod_valid and modified_win or nil) if sole_win then if panel_visible then - if panel_position == "left" then + if panel_position == "left" or panel_position == "right" then vim.api.nvim_win_set_width(panel_win, panel_config.width) -- Explicitly set diff window to fill remainder local remainder = vim.o.columns - panel_config.width - 1 @@ -117,7 +117,7 @@ function M.arrange(tabpage) -- Step 5: Re-pin panel size (undo disturbance from step 4) if panel_visible then - if panel_position == "left" then + if panel_position == "left" or panel_position == "right" then vim.api.nvim_win_set_width(panel_win, panel_config.width) else vim.api.nvim_win_set_height(panel_win, panel_config.height)