fix: always update preview when _selection_entry changes (#1693)
This commit is contained in:
@@ -930,6 +930,8 @@ function Picker:set_selection(row)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local old_entry
|
||||||
|
|
||||||
-- TODO: Probably should figure out what the rows are that made this happen...
|
-- 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?
|
-- Probably something with setting a row that's too high for this?
|
||||||
-- Not sure.
|
-- Not sure.
|
||||||
@@ -939,13 +941,15 @@ function Picker:set_selection(row)
|
|||||||
-- Check if previous selection is still visible
|
-- Check if previous selection is still visible
|
||||||
if self._selection_entry and self.manager:find_entry(self._selection_entry) then
|
if self._selection_entry and self.manager:find_entry(self._selection_entry) then
|
||||||
-- Find old selection, and update prefix and highlights
|
-- 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))
|
local old_row = self:get_row(self.manager:find_entry(old_entry))
|
||||||
|
|
||||||
self._selection_entry = entry
|
self._selection_entry = entry
|
||||||
|
|
||||||
|
if old_row >= 0 then
|
||||||
self:update_prefix(old_entry, old_row)
|
self:update_prefix(old_entry, old_row)
|
||||||
self.highlighter:hi_multiselect(old_row, self:is_multi_selected(old_entry))
|
self.highlighter:hi_multiselect(old_row, self:is_multi_selected(old_entry))
|
||||||
|
end
|
||||||
else
|
else
|
||||||
self._selection_entry = entry
|
self._selection_entry = entry
|
||||||
end
|
end
|
||||||
@@ -974,7 +978,7 @@ function Picker:set_selection(row)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if self._selection_entry == entry and self._selection_row == row then
|
if old_entry == entry and self._selection_row == row then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user