Skip to content

Resume does not restore the selected list item (cursor) position #612

Description

@KorigamiK

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

  1. Open the file picker and type a query that returns several results.
  2. Move the selection down a few entries (so the highlighted item is not the first one).
  3. Close the picker (with a non-empty query, so state is snapshotted).
  4. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions