feat: enhance cycle forward function#601
Conversation
Add ability to resume the last closed picker with full state (query, results, cursor, mode) by adapting for the refactored module structure. In the coordinator (picker_ui.lua): - save_state_and_close() deep-copies picker state before closing - restore_from_state() recreates UI from saved snapshot - M.close() overrides the wired close to save state then call close_windows - M.resume(), M.resume_find_files(), M.resume_live_grep() public API - Per-mode saved state (find_files vs live_grep) In layout_manager.lua: - Extracted close_windows() as the low-level cleanup - close() now delegates to close_windows() In main.lua: - find_files and live_grep support opts.resume - M.resume() public API for :FFFResume command plugin/fff.lua: - :FFFResume user command
|
@gustav-fff fix the merge conflict here |
Resolve merge conflict in lua/fff/picker_ui/picker_ui.lua by adopting upstream's unified resume_state table and close_active_for_resume() helper, while preserving the cycle-forward feature.
|
[triage-bot] DIRECTED: cannot push to fork (cross-repo PR), resolution diff below. Conflict is in Run on this branch: git fetch origin main
git merge origin/mainThen in --- @class fff.ResumeState
--- @field files table|nil Snapshot from last find_files session
--- @field grep table|nil Snapshot from last live_grep session
--- @field last_mode 'files'|'grep'|nil Mode of the most recently closed picker
local resume_state = { files = nil, grep = nil, last_mode = nil }function M.close()
if M.state.query == '' then
layout_manager.close()
return
end
if not M.state.active then return end
local snapshot = vim.deepcopy(M.state)
local fuzzy = require('fff.core').ensure_initialized()
local ok, base_path = pcall(fuzzy.get_base_path)
if ok and base_path then
snapshot.base_path = base_path
else
snapshot.base_path = M.state.config and M.state.config.base_path or nil
end
if M.state.mode == 'grep' then
resume_state.grep = snapshot
resume_state.last_mode = 'grep'
else
resume_state.files = snapshot
resume_state.last_mode = 'files'
end
layout_manager.close()
endFor
Honk-Honk 🪿 |
|
Hey @dmtrKovalenko , i've resolved the conflict |
Will be ready after #438
This PR enhances the behavior of the cycle query forawd by:
Before
before.mov
After
Screen.Recording.2026-06-14.at.21.25.08.mov