From be600b5421c652c84f94c0c75ba6d309165ed0ef Mon Sep 17 00:00:00 2001 From: Luke Kershaw <35707277+l-kershaw@users.noreply.github.com> Date: Mon, 4 Oct 2021 20:16:58 +0100 Subject: feat: more prompt position strategies (#1280) * feat: allow `prompt_position` for `vertical` layout strategy * feat: allow `prompt_position` for `bottom_pane` layout strategy * stylua * [docgen] Update doc/telescope.txt skip-checks: true * refactor: switch to `string.format` * stylua * feat: allow `prompt_position` for `center` layout strategy * feat: handle user defined `prompt_position` within themes * [docgen] Update doc/telescope.txt skip-checks: true * fix: tweak `center` layout - ensure `prompt` title is visible when `prompt_position="bottom"` * fix: refactor `center` tweak - move title to bottom of picker when `prompt_position="bottom"` * fix: tweak `bottom_pane` layout * stylua Co-authored-by: Github Actions --- lua/telescope/themes.lua | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'lua/telescope/themes.lua') diff --git a/lua/telescope/themes.lua b/lua/telescope/themes.lua index 5b334b1..398a842 100644 --- a/lua/telescope/themes.lua +++ b/lua/telescope/themes.lua @@ -52,6 +52,13 @@ function themes.get_dropdown(opts) preview = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, }, } + if opts.layout_config and opts.layout_config.prompt_position == "bottom" then + theme_opts.borderchars = { + prompt = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + results = { "─", "│", "─", "│", "╭", "╮", "┤", "├" }, + preview = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + } + end return vim.tbl_deep_extend("force", theme_opts, opts) end @@ -99,7 +106,7 @@ end function themes.get_ivy(opts) opts = opts or {} - return vim.tbl_deep_extend("force", { + local theme_opts = { theme = "ivy", sorting_strategy = "ascending", @@ -117,7 +124,16 @@ function themes.get_ivy(opts) results = { " " }, preview = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, }, - }, opts) + } + if opts.layout_config and opts.layout_config.prompt_position == "bottom" then + theme_opts.borderchars = { + prompt = { " ", " ", "─", " ", " ", " ", "─", "─" }, + results = { "─", " ", " ", " ", "─", "─", " ", " " }, + preview = { "─", " ", "─", "│", "┬", "─", "─", "╰" }, + } + end + + return vim.tbl_deep_extend("force", theme_opts, opts) end return themes -- cgit v1.2.3