fix: selection_strategies row and follow (#218)

This commit is contained in:
Simon Hauser
2020-11-13 16:20:09 +01:00
committed by GitHub
parent 64aae0abd8
commit ba52c70a60
2 changed files with 10 additions and 4 deletions

View File

@@ -53,7 +53,7 @@ function EntryManager:new(max_results, set_entry, info)
local existing_entry = v.entry local existing_entry = v.entry
-- FIXME: This has the problem of assuming that display will not be the same for two different entries. -- FIXME: This has the problem of assuming that display will not be the same for two different entries.
if existing_entry.display == entry.display then if existing_entry == entry then
return k return k
end end
end end

View File

@@ -683,8 +683,14 @@ function Picker:set_selection(row)
row = self:_handle_scroll_strategy(row) row = self:_handle_scroll_strategy(row)
if not self:can_select_row(row) then if not self:can_select_row(row) then
log.debug("Cannot select row:", row, self.manager:num_results(), self.max_results) -- If the current selected row exceeds number of currently displayed
return -- elements we have to reset it. Affectes sorting_strategy = 'row'.
if not self:can_select_row(self:get_selection_row()) then
row = self:get_row(self.manager:num_results())
else
log.debug("Cannot select row:", row, self.manager:num_results(), self.max_results)
return
end
end end
-- local entry = self.manager:get_entry(self.max_results - row + 1) -- local entry = self.manager:get_entry(self.max_results - row + 1)