summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorrockerBOO <rockerboo@gmail.com>2020-09-17 21:42:50 -0400
committerrockerBOO <rockerboo@gmail.com>2020-09-17 21:42:50 -0400
commit8cc6e678518752bf8440059d495bfd1bbf48e496 (patch)
tree5fad6cd6bcd134986878d177fdabe49293434b85 /lua
parentc043f90de0241dc22aca2d14bc8ce4d8e34bf9d8 (diff)
fix: Resolve many display issues with the dropdown theme
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/pickers/layout_strategies.lua16
-rw-r--r--lua/telescope/themes.lua5
2 files changed, 16 insertions, 5 deletions
diff --git a/lua/telescope/pickers/layout_strategies.lua b/lua/telescope/pickers/layout_strategies.lua
index 5f25511..7016301 100644
--- a/lua/telescope/pickers/layout_strategies.lua
+++ b/lua/telescope/pickers/layout_strategies.lua
@@ -27,6 +27,7 @@ end
local layout_strategies = {}
local log = require("telescope.log")
local resolve = require("telescope.config.resolve")
+
--[[
+-----------------+---------------------+
| | |
@@ -123,7 +124,7 @@ end
-- Check if there are any borders. Right now it's a little raw as
-- there are a few things that contribute to the border
local is_borderless = function(opts)
- if opts.window.border == false then return true end
+ if opts.window.border == false then return true else return false end
end
layout_strategies.center = function(self, columns, lines, prompt_title)
@@ -133,8 +134,17 @@ layout_strategies.center = function(self, columns, lines, prompt_title)
local prompt = initial_options.prompt
local max_results = self.max_results or 15
- local width = self.width or 70
+ local width = resolve.resolve_width(function(self, max_columns)
+ local width_opts = resolve.win_option(self.window.width)
+
+ if width_opts.preview > max_columns then
+ return max_columns
+ end
+
+ return width_opts.preview
+ end)(self, columns)
+ -- All width's will likely result in the same width. Can be more specific with inquiry.
local max_width = (width > columns and columns or width)
prompt.height = 1
@@ -152,7 +162,7 @@ layout_strategies.center = function(self, columns, lines, prompt_title)
results.line = prompt.line + prompt.height + (bs * 2)
preview.line = 1
- preview.height = math.floor(prompt.line - 2)
+ preview.height = math.floor(prompt.line - (2 + bs))
if not self.previewer or columns < self.preview_cutoff then
preview.height = 0
diff --git a/lua/telescope/themes.lua b/lua/telescope/themes.lua
index 54476cc..f4c19ca 100644
--- a/lua/telescope/themes.lua
+++ b/lua/telescope/themes.lua
@@ -17,11 +17,12 @@ function themes.get_dropdown(opts)
layout_strategy = "center",
results_title = false,
preview_title = "Preview",
- border = false,
+ width = 70,
borderchars = {
+ { '─', '│', '─', '│', '╭', '╮', '╯', '╰'},
prompt = {"─", "│", " ", "│", "╭", "╮", "│", "│"},
results = {"─", "│", "─", "│", "├", "┤", "╯", "╰"},
- preview = {"=", "=", "", "", "", "", "", ""}
+ preview = { '─', '│', '─', '│', '╭', '╮', '╯', '╰'},
},
}