fix(picker): ensure that the selected result matches the screen display in ascending sort order #2986
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The current stable version (v0.9.5) and the nightly version have different results for the cursor position on the displayed content, I don't know exactly why.
After debugging, I found that this line of code causes the cursor to move down(row+1) when
sorting_strategy=ascending
,this result is consistent in v0.9.5 and nightly.telescope.nvim/lua/telescope/pickers.lua
Line 436 in 67c598f
However, when the result is displayed, the highlighted row and the cursor position are not the same, so it cannot be displayed in nightly version(by default, the second result is displayed at the top, in the same position as the cursor.).
So I think putting the cursor to the first line (i.e. highest score) again in
Picker:get_result_completor
fixes the problem and doesn't affect older versions.Fixes # (issue)
#2697
Type of change