Skip to content

Conversation

@Tokamak-USTC
Copy link

@Tokamak-USTC Tokamak-USTC commented Dec 9, 2025

Description

This PR addresses an issue where cursor movement and flash.nvim integration behave abnormally when using picker.list with a reverse layout (e.g., telescope).

The issue was caused by a mismatch between the item index (idx) and the visual row (row) in reverse mode.

  • In function row2idx(list.lua:203): ret = row + self.top - 1 the original return value was: self.state.height - ret + 1 which expands to: self.state.height - (row + self.top - 1) + 1 = self.state.height - row - self.top + 2
  • For row in the range 1..self.state.height, ret ranges from self.top to (self.top + self.state.height - 1), so the return value’s minimum is roughly -self.top + 2,which can be less than zero.

This fix ensures that:

  • Cursor navigation correctly maps to the intended visual item in reverse lists.
  • flash jumps target the correct item regardless of the list direction.

Related Issue(s)

Fixes #2605

Screenshots

after:

20251210-000603.mp4

@github-actions github-actions bot added picker size/xs Extra small PR (<3 lines changed) labels Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

picker size/xs Extra small PR (<3 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Picker list abnormal cursor movement and flash integration in telescope (reverse) layout

1 participant