diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2020-11-13 16:20:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-13 10:20:09 -0500 |
| commit | ba52c70a60fb7e34a1512355ace2cd984705b7c6 (patch) | |
| tree | b661ad310b3d8a29bfad866e47d9a96882e1e7bc /lua/telescope/pickers.lua | |
| parent | 64aae0abd83ac852c9751d4b42310f6a213c3fd1 (diff) | |
fix: selection_strategies row and follow (#218)
Diffstat (limited to 'lua/telescope/pickers.lua')
| -rw-r--r-- | lua/telescope/pickers.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua index fea687d..43d3b96 100644 --- a/lua/telescope/pickers.lua +++ b/lua/telescope/pickers.lua @@ -683,8 +683,14 @@ function Picker:set_selection(row) row = self:_handle_scroll_strategy(row) if not self:can_select_row(row) then - log.debug("Cannot select row:", row, self.manager:num_results(), self.max_results) - return + -- If the current selected row exceeds number of currently displayed + -- 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 -- local entry = self.manager:get_entry(self.max_results - row + 1) |
