feat: no longer need to set minheight in window_options
This commit is contained in:
@@ -186,6 +186,13 @@ function Picker:find()
|
|||||||
-- 3. Preview window
|
-- 3. Preview window
|
||||||
local popup_opts = self:get_window_options(vim.o.columns, vim.o.lines, prompt_string)
|
local popup_opts = self:get_window_options(vim.o.columns, vim.o.lines, prompt_string)
|
||||||
|
|
||||||
|
-- `popup.nvim` massaging so people don't have to remember minheight shenanigans
|
||||||
|
popup_opts.results.minheight = popup_opts.results.height
|
||||||
|
popup_opts.prompt.minheight = popup_opts.prompt.height
|
||||||
|
if popup_opts.preview then
|
||||||
|
popup_opts.preview.minheight = popup_opts.preview.height
|
||||||
|
end
|
||||||
|
|
||||||
-- TODO: Add back the borders after fixing some stuff in popup.nvim
|
-- TODO: Add back the borders after fixing some stuff in popup.nvim
|
||||||
local results_win, results_opts = popup.create('', popup_opts.results)
|
local results_win, results_opts = popup.create('', popup_opts.results)
|
||||||
local results_bufnr = a.nvim_win_get_buf(results_win)
|
local results_bufnr = a.nvim_win_get_buf(results_win)
|
||||||
|
|||||||
@@ -50,13 +50,10 @@ layout_strategies.horizontal = function(self, max_columns, max_lines, prompt_tit
|
|||||||
base_height = math.floor(max_lines * 0.8)
|
base_height = math.floor(max_lines * 0.8)
|
||||||
end
|
end
|
||||||
results.height = base_height
|
results.height = base_height
|
||||||
results.minheight = results.height
|
|
||||||
prompt.height = 1
|
prompt.height = 1
|
||||||
prompt.minheight = prompt.height
|
|
||||||
|
|
||||||
if self.previewer then
|
if self.previewer then
|
||||||
preview.height = results.height + prompt.height + 2
|
preview.height = results.height + prompt.height + 2
|
||||||
preview.minheight = preview.height
|
|
||||||
else
|
else
|
||||||
preview.height = 0
|
preview.height = 0
|
||||||
end
|
end
|
||||||
@@ -114,17 +111,13 @@ layout_strategies.vertical = function(self, max_columns, max_lines, prompt_title
|
|||||||
local height_padding = 3
|
local height_padding = 3
|
||||||
|
|
||||||
results.height = 10
|
results.height = 10
|
||||||
results.minheight = 10
|
|
||||||
prompt.height = 1
|
prompt.height = 1
|
||||||
prompt.minheight = 1
|
|
||||||
|
|
||||||
-- The last 2 * 2 is for the extra borders
|
-- The last 2 * 2 is for the extra borders
|
||||||
if self.previewer then
|
if self.previewer then
|
||||||
preview.height = max_lines - results.height - prompt.height - 2 * 2 - height_padding * 2
|
preview.height = max_lines - results.height - prompt.height - 2 * 2 - height_padding * 2
|
||||||
preview.minheight = preview.height
|
|
||||||
else
|
else
|
||||||
results.height = max_lines - prompt.height - 2 - height_padding * 2
|
results.height = max_lines - prompt.height - 2 - height_padding * 2
|
||||||
results.minheight = results.height
|
|
||||||
end
|
end
|
||||||
|
|
||||||
results.col, preview.col, prompt.col = width_padding, width_padding, width_padding
|
results.col, preview.col, prompt.col = width_padding, width_padding, width_padding
|
||||||
|
|||||||
Reference in New Issue
Block a user