diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-10-20 19:57:59 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-10-20 19:57:59 -0400 |
| commit | 14f834b754844f9fba49b3c032753529553507fb (patch) | |
| tree | 0219c1597cc4098137e5887f6e0f71eed0f71946 /lua | |
| parent | b98509b4ad507637dc43bff3c45e8be8cb8f756c (diff) | |
fix: trim spaces from prompt string
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/pickers.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua index c746c16..30780d1 100644 --- a/lua/telescope/pickers.lua +++ b/lua/telescope/pickers.lua @@ -338,11 +338,13 @@ function Picker:find() -- Prompt prefix local prompt_prefix = self.prompt_prefix if prompt_prefix ~= '' then - if not vim.endswith(prompt_prefix, ' ') then - prompt_prefix = prompt_prefix.." " - end a.nvim_buf_set_option(prompt_bufnr, 'buftype', 'prompt') + + if not vim.endswith(prompt_prefix, " ") then + prompt_prefix = prompt_prefix .. " " + end vim.fn.prompt_setprompt(prompt_bufnr, prompt_prefix) + a.nvim_buf_add_highlight(prompt_bufnr, ns_telescope_prompt_prefix, 'TelescopePromptPrefix', 0, 0, #prompt_prefix) end @@ -389,7 +391,7 @@ function Picker:find() return end - local prompt = vim.api.nvim_buf_get_lines(prompt_bufnr, first_line, last_line, false)[1]:sub(#prompt_prefix) + local prompt = vim.trim(vim.api.nvim_buf_get_lines(prompt_bufnr, first_line, last_line, false)[1]:sub(#prompt_prefix)) -- TODO: Statusbar possibilities here. -- vim.api.nvim_buf_set_virtual_text(prompt_bufnr, 0, 1, { {"hello", "Error"} }, {}) |
