From e764f488b77b5f75a3eb9988a582045b489ffa09 Mon Sep 17 00:00:00 2001 From: Ross Tang Date: Sun, 14 May 2023 15:52:59 +0800 Subject: [PATCH 1/2] Sort the windows so that the window with the least handle value will not be closed. It is usually the main editinig window. When there is no window, make sure cur_win is defined Signed-off-by: Ross Tang --- lua/ide/buffers/diffbuffer.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/ide/buffers/diffbuffer.lua b/lua/ide/buffers/diffbuffer.lua index a600430..57492c9 100644 --- a/lua/ide/buffers/diffbuffer.lua +++ b/lua/ide/buffers/diffbuffer.lua @@ -41,10 +41,12 @@ DiffBuffer.new = function(path_a, path_b) -- if no wins, create one if #wins == 0 then + local cur_win = vim.api.nvim_get_current_win() vim.cmd("vsplit") -- may inherit the SB win highlight, reset it. vim.api.nvim_win_set_option(cur_win, 'winhighlight', 'Normal:Normal') else + table.sort(wins) vim.api.nvim_set_current_win(wins[1]) end From f6795f94d1fdb55ffe9dae5462fd2367723a0e42 Mon Sep 17 00:00:00 2001 From: Ross Tang Date: Sun, 14 May 2023 16:58:17 +0800 Subject: [PATCH 2/2] Fix explorer expanding to wrong directory Signed-off-by: Ross Tang --- lua/ide/components/explorer/component.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/ide/components/explorer/component.lua b/lua/ide/components/explorer/component.lua index 24b60bf..56f5d10 100644 --- a/lua/ide/components/explorer/component.lua +++ b/lua/ide/components/explorer/component.lua @@ -568,7 +568,7 @@ ExplorerComponent.new = function(name, config) return false end - local current = vim.fn.fnamemodify(root.path, ":.") + local current = vim.fn.fnamemodify(root.path, ":.") .. '/' if vim.fn.strpart(dest, 0, #current) == current then if not self.tree.root.expanded then