261020.27 · a306c293b37bd7c8c1e8e1e6c0d7d3d9c3de3f21
fix(skim): use restart fallback for reload actions
Skim supports the fzf `reload` action but not `rebind`, so the action keys unbound before the reload are never restored (the `load` event fires but `rebind` is a no-op). This made reload actions work only once, e.g. staging a single file in `git_status` or wiping a single buffer.
Always use the old-style `resume` fallback with skim. It restarts the picker and keeps the key binds working. Add `_reload_fallback` to force the same code path with any fzf binary so it can be tested without skim or an old fzf.
Tests:
- tests/git_status_spec.lua: stage/unstage/stage/reset using the fallback
- tests/core_spec.lua: skim and forced fallback select the resume action
reading declarations
Changes to tests/core_spec.lua. All files
@@ -142,4 +142,22 @@ describe("Testing core cli construction", function() end assert.is.True(found) end)++ it("selects the resume fallback for skim and forced fallback", function()+ local core = require("fzf-lua.core")+ local actions = require("fzf-lua.actions")+ local assert_fallback = function(opts)+ opts.actions = { ["ctrl-x"] = { fn = function() end, reload = true } }+ opts.keymap = { fzf = {} }+ opts = core.convert_reload_actions("true", opts)+ -- old-style action: { <fn>, actions.resume } restarts the picker+ assert.is.True(type(opts.actions["ctrl-x"]) == "table")+ assert.is.True(type(opts.actions["ctrl-x"][1]) == "function")+ assert.is.True(opts.actions["ctrl-x"][2] == actions.resume)+ end+ -- skim supports `reload` but not `rebind`, so it must use the fallback+ assert_fallback({ __SK_VERSION = { 5, 6, 6 } })+ -- internal override used by tests to exercise the fallback on fzf+ assert_fallback({ __FZF_VERSION = { 0, 74, 5 }, _reload_fallback = true })+ end) end)