summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorLuke Kershaw <35707277+l-kershaw@users.noreply.github.com>2022-01-18 06:45:03 +0000
committerGitHub <noreply@github.com>2022-01-18 07:45:03 +0100
commit1ec682b29d49aeb7843d7eb58b1e45d84aac045f (patch)
tree3d1c848e209a06574a6d67262104c0e77334ce0b /lua
parentc1b9dab30030820999145ee6292fce7dc092c4fe (diff)
fix: always update preview when `_selection_entry` changes (#1693)
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/pickers.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua
index 684f12a..7504924 100644
--- a/lua/telescope/pickers.lua
+++ b/lua/telescope/pickers.lua
@@ -930,6 +930,8 @@ function Picker:set_selection(row)
return
end
+ local old_entry
+
-- TODO: Probably should figure out what the rows are that made this happen...
-- Probably something with setting a row that's too high for this?
-- Not sure.
@@ -939,13 +941,15 @@ function Picker:set_selection(row)
-- Check if previous selection is still visible
if self._selection_entry and self.manager:find_entry(self._selection_entry) then
-- Find old selection, and update prefix and highlights
- local old_entry = self._selection_entry
+ old_entry = self._selection_entry
local old_row = self:get_row(self.manager:find_entry(old_entry))
self._selection_entry = entry
- self:update_prefix(old_entry, old_row)
- self.highlighter:hi_multiselect(old_row, self:is_multi_selected(old_entry))
+ if old_row >= 0 then
+ self:update_prefix(old_entry, old_row)
+ self.highlighter:hi_multiselect(old_row, self:is_multi_selected(old_entry))
+ end
else
self._selection_entry = entry
end
@@ -974,7 +978,7 @@ function Picker:set_selection(row)
return
end
- if self._selection_entry == entry and self._selection_row == row then
+ if old_entry == entry and self._selection_row == row then
return
end