diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2021-04-22 17:55:06 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2021-04-22 17:55:06 -0400 |
| commit | a28999574efb7a0d5bddb2e7eb543ff7d4cf14b4 (patch) | |
| tree | f1497802b4b1450d9c86a1d1209c58c1567540ff /lua | |
| parent | c6980a9acf8af836196508000c34dcb06b11137b (diff) | |
feat: allow reset prompt to set text as well
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/pickers.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua index 3a5baf7..d23d1b2 100644 --- a/lua/telescope/pickers.lua +++ b/lua/telescope/pickers.lua @@ -386,7 +386,7 @@ function Picker:find() if not last_line then last_line = 1 end if first_line > 0 or last_line > 1 then - log.debug("ON_LINES: Bad range", first_line, last_line) + log.debug("ON_LINES: Bad range", first_line, last_line, self:_get_prompt()) return end @@ -618,9 +618,15 @@ function Picker:change_prompt_prefix(new_prefix, hl_group) self:_reset_prefix_color(hl_group) end -function Picker:reset_prompt() - vim.api.nvim_buf_set_lines(self.prompt_bufnr, 0, -1, false, { self.prompt_prefix }) +function Picker:reset_prompt(text) + local prompt_text = self.prompt_prefix .. (text or '') + vim.api.nvim_buf_set_lines(self.prompt_bufnr, 0, -1, false, { prompt_text }) + self:_reset_prefix_color(self._current_prefix_hl_group) + + if text then + vim.api.nvim_win_set_cursor(self.prompt_win, {1, #prompt_text}) + end end --- opts.new_prefix: Either as string or { new_string, hl_group } |
