diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2022-06-13 18:53:16 +0200 |
|---|---|---|
| committer | Simon Hauser <simon.hauser@helsinki-systems.de> | 2022-06-30 14:01:52 +0200 |
| commit | 25b1bc8f17e1b658551cf2435fa2070dc96edc4e (patch) | |
| tree | 1c627f953a1fbd82f386ef2dccaa3b47d31d7c82 /lua/telescope/pickers.lua | |
| parent | bef86acb6c9ddf25602d28f4ad4980806f25420e (diff) | |
feat: clear previewer if no item is selected (#2004)
Diffstat (limited to 'lua/telescope/pickers.lua')
| -rw-r--r-- | lua/telescope/pickers.lua | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua index 9397c57..1a45cd4 100644 --- a/lua/telescope/pickers.lua +++ b/lua/telescope/pickers.lua @@ -965,6 +965,9 @@ function Picker:set_selection(row) state.set_global_key("selected_entry", entry) if not entry then + -- also refresh previewer when there is no entry selected, so the preview window is cleared + self._selection_entry = entry + self:refresh_previewer() return end @@ -1068,10 +1071,6 @@ end --- Refresh the previewer based on the current `status` of the picker function Picker:refresh_previewer() local status = state.get_status(self.prompt_bufnr) - if not self._selection_entry then - -- if selection_entry is nil there is nothing to be previewed - return - end if self.previewer and status.preview_win and a.nvim_win_is_valid(status.preview_win) then self:_increment "previewed" |
