From 20bbb5a861f3ff1a555c0ad9a707a1e088a86c35 Mon Sep 17 00:00:00 2001 From: Jerry Chen Date: Fri, 12 Jul 2024 16:25:42 -0700 Subject: [PATCH] Check window width and height for focus_max_or_equal At present it only checks for window width, which works for vertical splits. However, horizontal splits will not properly maximise since they will always have the max width, so attempts to focus_max_or_equal will always lead to focus_equalise. --- lua/focus/modules/functions.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/focus/modules/functions.lua b/lua/focus/modules/functions.lua index f36d00e..900c8b0 100644 --- a/lua/focus/modules/functions.lua +++ b/lua/focus/modules/functions.lua @@ -44,7 +44,9 @@ end M.focus_max_or_equal = function() local winwidth = vim.fn.winwidth(vim.api.nvim_get_current_win()) - if winwidth > vim.o.columns / 2 then + local winheight = vim.fn.winheight(vim.api.nvim_get_current_win()) + local bigger_than_half = (winwidth > vim.o.columns / 2) and (winheight > vim.o.lines / 2) + if bigger_than_half then M.focus_equalise() else M.focus_maximise()