diff --git a/lua/fff/picker_ui/search_manager.lua b/lua/fff/picker_ui/search_manager.lua index c75673c3..b6907c93 100644 --- a/lua/fff/picker_ui/search_manager.lua +++ b/lua/fff/picker_ui/search_manager.lua @@ -315,11 +315,18 @@ function M.cycle_forward_query() if not P.state.active then return end if S.history_offset == nil then - S.history_offset = 0 - elseif S.history_offset > 0 then - S.history_offset = S.history_offset - 1 - else + -- At top of stack (fresh open or resume with pre-filled input). + -- Clear input to return to a clean slate. + S.history_offset = nil + vim.api.nvim_buf_set_lines(S.input_buf, 0, -1, false, { S.config.prompt }) return + elseif S.history_offset == 0 then + -- At the most recent history entry, go back to present + S.history_offset = nil + vim.api.nvim_buf_set_lines(S.input_buf, 0, -1, false, { S.config.prompt }) + return + else + S.history_offset = S.history_offset - 1 end local fuzzy = require('fff.core').ensure_initialized()