summaryrefslogtreecommitdiff
path: root/lua/telescope/pickers
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-10-08 12:53:42 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-10-08 12:53:42 -0400
commit9d894f8229cdece3b5ab8b2d5200f7d2d39ed5e8 (patch)
tree8fa3fd7181eec929f89397d8d5810d4107110f79 /lua/telescope/pickers
parent8736ea5f6a47c87c206b21e64bdd2eaed57e84bf (diff)
fix: Respect cmdheight and laststatus
Diffstat (limited to 'lua/telescope/pickers')
-rw-r--r--lua/telescope/pickers/layout_strategies.lua23
1 files changed, 15 insertions, 8 deletions
diff --git a/lua/telescope/pickers/layout_strategies.lua b/lua/telescope/pickers/layout_strategies.lua
index f823da8..b43466c 100644
--- a/lua/telescope/pickers/layout_strategies.lua
+++ b/lua/telescope/pickers/layout_strategies.lua
@@ -215,18 +215,25 @@ layout_strategies.vertical = function(self, max_columns, max_lines)
prompt.width = width
-- Height
- local height_padding = resolve.resolve_height(layout_config.height_padding or 3)(self, max_columns, max_lines)
-
- results.height = resolve.resolve_height(layout_config.results_height or 10)(self, max_columns, max_lines)
- prompt.height = 1
+ local height_padding = math.max(
+ 1,
+ resolve.resolve_height(layout_config.height_padding or 3)(self, max_columns, max_lines)
+ )
+ local picker_height = max_lines - 2 * height_padding
- -- The last 2 * 2 is for the extra borders
+ local preview_total = 0
+ preview.height = 0
if self.previewer then
- preview.height = max_lines - results.height - prompt.height - 2 * 2 - height_padding * 2
- else
- results.height = max_lines - prompt.height - 2 - height_padding * 2
+ preview.height = resolve.resolve_height(
+ layout_config.preview_height or (max_lines - 15)
+ )(self, max_columns, picker_height)
+
+ preview_total = preview.height + 2
end
+ prompt.height = 1
+ results.height = picker_height - preview_total - prompt.height - 2
+
results.col, preview.col, prompt.col = width_padding, width_padding, width_padding
if self.previewer then