diff --git a/doc/telescope.txt b/doc/telescope.txt index 8976dc2..c35be3d 100644 --- a/doc/telescope.txt +++ b/doc/telescope.txt @@ -214,9 +214,10 @@ telescope.setup({opts}) *telescope.setup()* *telescope.defaults.winblend* winblend: ~ Configure winblend for telescope floating windows. See |winblend| for - more information. + more information. Type can be a number or a function returning a + number - Default: 0 + Default: function() return vim.o.winblend end *telescope.defaults.wrap_results* wrap_results: ~ diff --git a/lua/telescope/actions/init.lua b/lua/telescope/actions/init.lua index 5acc8da..c7f80d8 100644 --- a/lua/telescope/actions/init.lua +++ b/lua/telescope/actions/init.lua @@ -1241,6 +1241,9 @@ actions.which_key = function(prompt_bufnr, opts) opts.normal_hl = vim.F.if_nil(opts.normal_hl, "TelescopePrompt") opts.border_hl = vim.F.if_nil(opts.border_hl, "TelescopePromptBorder") opts.winblend = vim.F.if_nil(opts.winblend, conf.winblend) + if type(opts.winblend) == "function" then + opts.winblend = opts.winblend() + end opts.column_padding = vim.F.if_nil(opts.column_padding, " ") -- Assigning into 'opts.column_indent' would override a number with a string and diff --git a/lua/telescope/config.lua b/lua/telescope/config.lua index d6b4712..48271db 100644 --- a/lua/telescope/config.lua +++ b/lua/telescope/config.lua @@ -219,12 +219,15 @@ append( append( "winblend", - 0, + function() + return vim.o.winblend + end, [[ Configure winblend for telescope floating windows. See |winblend| for - more information. + more information. Type can be a number or a function returning a + number - Default: 0]] + Default: function() return vim.o.winblend end]] ) append( diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua index ed2b17e..a871761 100644 --- a/lua/telescope/pickers.lua +++ b/lua/telescope/pickers.lua @@ -244,6 +244,11 @@ function Picker:new(opts) -- end local layout_strategy = vim.F.if_nil(opts.layout_strategy, config.values.layout_strategy) + local winblend = + vim.F.if_nil(opts.winblend, type(opts.window) == "table" and opts.window.winblend or config.values.winblend) + if type(winblend) == "function" then + winblend = winblend() + end local obj = setmetatable({ prompt_title = vim.F.if_nil(opts.prompt_title, config.values.prompt_title), @@ -305,10 +310,7 @@ function Picker:new(opts) __cycle_layout_list = vim.F.if_nil(opts.cycle_layout_list, config.values.cycle_layout_list), window = { - winblend = vim.F.if_nil( - opts.winblend, - type(opts.window) == "table" and opts.window.winblend or config.values.winblend - ), + winblend = winblend, border = vim.F.if_nil(opts.border, type(opts.window) == "table" and opts.window.border or config.values.border), borderchars = vim.F.if_nil( opts.borderchars,