diff --git a/lua/quicker/init.lua b/lua/quicker/init.lua index 8339d13..42ae32b 100644 --- a/lua/quicker/init.lua +++ b/lua/quicker/init.lua @@ -140,6 +140,7 @@ end ---Open the quickfix or loclist window. ---@param opts? quicker.OpenOpts M.open = function(opts) + local util = require("quicker.util") ---@type {loclist: boolean, focus: boolean, height?: integer, min_height: integer, max_height: integer, open_cmd_mods?: quicker.OpenCmdMods} opts = vim.tbl_deep_extend("keep", opts or {}, { loclist = false, @@ -161,8 +162,11 @@ M.open = function(opts) height = #vim.fn.getqflist() end - height = math.min(opts.max_height, math.max(opts.min_height, height)) - vim.api.nvim_win_set_height(0, height) + -- only set the height if the quickfix is not a full-height vsplit + if not util.is_full_height_vsplit(0) then + height = math.min(opts.max_height, math.max(opts.min_height, height)) + vim.api.nvim_win_set_height(0, height) + end if not opts.focus then vim.cmd.wincmd({ args = { "p" } }) diff --git a/lua/quicker/util.lua b/lua/quicker/util.lua index 045c943..3794091 100644 --- a/lua/quicker/util.lua +++ b/lua/quicker/util.lua @@ -71,4 +71,25 @@ M.get_lnum_extmarks = function(bufnr, lnum, line_len, ns) end, extmarks) end +---Return true if the window is a full-height leaf window +---@param winid? integer +---@return boolean +M.is_full_height_vsplit = function(winid) + if not winid or winid == 0 then + winid = vim.api.nvim_get_current_win() + end + local layout = vim.fn.winlayout() + -- If the top layout is not vsplit, then it's not a vertical leaf + if layout[1] ~= "row" then + return false + end + for _, v in ipairs(layout[2]) do + if v[1] == "leaf" and v[2] == winid then + return true + end + end + + return false +end + return M