feat: add top down prompt position

This commit is contained in:
TJ DeVries
2020-09-10 21:21:14 -04:00
parent 769f5934f0
commit fe387d10db
4 changed files with 145 additions and 20 deletions

View File

@@ -64,9 +64,18 @@ layout_strategies.horizontal = function(self, max_columns, max_lines, prompt_tit
-- TODO: Center this in the page a bit better.
local height_padding = math.max(math.floor(0.95 * max_lines), 2)
results.line = max_lines - height_padding
prompt.line = results.line + results.height + 2
preview.line = results.line
if self.window.prompt_position == "top" then
prompt.line = max_lines - height_padding
results.line = prompt.line + 3
preview.line = prompt.line
elseif self.window.prompt_position == "bottom" then
results.line = max_lines - height_padding
prompt.line = results.line + results.height + 2
preview.line = results.line
else
error("Unknown prompt_position: " .. self.window.prompt_position)
end
return {
preview = preview.width > 0 and preview,