Description
When resuming a picker (resume, resume_find_files, resume_live_grep), the previously selected list entry is not restored — the selection always jumps back to the first result, even though the query, results, and scroll state are otherwise restored.
Steps to reproduce
- Open the file picker and type a query that returns several results.
- Move the selection down a few entries (so the highlighted item is not the first one).
- Close the picker (with a non-empty query, so state is snapshotted).
- Resume the picker.
Expected: the same list item is highlighted as when the picker was closed.
Actual: the selection resets to the first result.
Root cause
restore_from_state (lua/fff/picker_ui/picker_ui.lua) restores state.cursor correctly, but then writes the saved query into the input buffer. The input buffer's on_lines callback (ui_creator.lua) schedules on_input_change, which re-runs the search via update_results_sync and unconditionally sets S.cursor = 1 (search_manager.lua), discarding the restored cursor.
Environment
- fff.nvim: latest
main
- Neovim: any recent version
Description
When resuming a picker (
resume,resume_find_files,resume_live_grep), the previously selected list entry is not restored — the selection always jumps back to the first result, even though the query, results, and scroll state are otherwise restored.Steps to reproduce
Expected: the same list item is highlighted as when the picker was closed.
Actual: the selection resets to the first result.
Root cause
restore_from_state(lua/fff/picker_ui/picker_ui.lua) restoresstate.cursorcorrectly, but then writes the saved query into the input buffer. The input buffer'son_linescallback (ui_creator.lua) scheduleson_input_change, which re-runs the search viaupdate_results_syncand unconditionally setsS.cursor = 1(search_manager.lua), discarding the restored cursor.Environment
main