summaryrefslogtreecommitdiff
path: root/lua/telescope/pickers/layout_strategies.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2021-04-08 10:35:44 -0400
committerGitHub <noreply@github.com>2021-04-08 10:35:44 -0400
commit64e59060b1750d0c86761693b6847c3db07afcd2 (patch)
tree13e8c0117cdff926e7bbf107f5496c733329cfb7 /lua/telescope/pickers/layout_strategies.lua
parente5fbe6fe60149af8fdeef0d07cba06c029258ba0 (diff)
feat: asyncify pickers - except for live_grep (#709)
* something kind of works already * yayayayayayayayayayayayayayayayayayayayayayayayayayayayayayayayaya * use async for everything besides live jobs * fix: fixup autocmds previewer * fix: lints for prime * temp: Add example of how we can think about async sorters * feat: Allow picker to decide when to cancel * fix: simplify scoring logic and tests * fixup: name * fix: Move back towards more backwards compat methods * fixup: Remove results from opts * fixup: remove trailing quote * fixup: Attempt to clean up some more async items. Next is status * wip: Add todo for when bfredl implements extmarks over the EOL * wip * fixup: got em * fixup: cleaning * fixup: docs
Diffstat (limited to 'lua/telescope/pickers/layout_strategies.lua')
-rw-r--r--lua/telescope/pickers/layout_strategies.lua40
1 files changed, 37 insertions, 3 deletions
diff --git a/lua/telescope/pickers/layout_strategies.lua b/lua/telescope/pickers/layout_strategies.lua
index b8d9aea..b4c9fda 100644
--- a/lua/telescope/pickers/layout_strategies.lua
+++ b/lua/telescope/pickers/layout_strategies.lua
@@ -61,6 +61,40 @@
local config = require('telescope.config')
local resolve = require("telescope.config.resolve")
+local function get_initial_window_options(picker)
+ local popup_border = resolve.win_option(picker.window.border)
+ local popup_borderchars = resolve.win_option(picker.window.borderchars)
+
+ local preview = {
+ title = picker.preview_title,
+ border = popup_border.preview,
+ borderchars = popup_borderchars.preview,
+ enter = false,
+ highlight = false
+ }
+
+ local results = {
+ title = picker.results_title,
+ border = popup_border.results,
+ borderchars = popup_borderchars.results,
+ enter = false,
+ }
+
+ local prompt = {
+ title = picker.prompt_title,
+ border = popup_border.prompt,
+ borderchars = popup_borderchars.prompt,
+ enter = true
+ }
+
+ return {
+ preview = preview,
+ results = results,
+ prompt = prompt,
+ }
+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)
@@ -105,7 +139,7 @@ layout_strategies.horizontal = function(self, max_columns, max_lines)
scroll_speed = "The speed when scrolling through the previewer",
})
- local initial_options = self:_get_initial_window_options()
+ local initial_options = get_initial_window_options(self)
local preview = initial_options.preview
local results = initial_options.results
local prompt = initial_options.prompt
@@ -203,7 +237,7 @@ end
--- +--------------+
--- </pre>
layout_strategies.center = function(self, columns, lines)
- local initial_options = self:_get_initial_window_options()
+ local initial_options = get_initial_window_options(self)
local preview = initial_options.preview
local results = initial_options.results
local prompt = initial_options.prompt
@@ -273,7 +307,7 @@ layout_strategies.vertical = function(self, max_columns, max_lines)
scroll_speed = "The speed when scrolling through the previewer",
})
- local initial_options = self:_get_initial_window_options()
+ local initial_options = get_initial_window_options(self)
local preview = initial_options.preview
local results = initial_options.results
local prompt = initial_options.prompt