261101.1 · 07fce8ac8dffba4e11f1cbe5490d730a2cc5ec7a
fix(git): fix fish preview quoting for special char paths
git_preview() wrapped preview commands in `sh -c '...'` on fish to work around fish resetting `$COLUMNS` (delta width, #1023). fzf substitutes placeholders such as `{-1}` after `--preview` is passed, so fzf's quoted path was inserted inside the outer single quotes. Paths containing shell special characters (e.g. parentheses) then broke the command (`sh: Syntax error: "(" unexpected`), while simple paths happened to work.
The wrapper is no longer needed: use fzf's `$FZF_PREVIEW_COLUMNS` for the delta pager, which fzf exports explicitly and shells do not reset. Skim does not provide the FZF variables to preview commands, so select `$COLUMNS` when the picker runs on skim. Pass resolved opts through pager functions so the correct variable is chosen per picker.
Add a git_diff regression test for a `(dir)/file.tsx` path. The test uses fish when available and falls back to an `sh` symlink named `fish` so the fish-only code path is also covered in CI images without fish. Also cover the pager variable selection for fzf and skim.
Fixes #2846
reading declarations
Changes to tests/config_spec.lua. All files
@@ -146,3 +146,38 @@ describe("Testing config version gate", function() eq(err, nil) end) end)++describe("Testing preview pager", function()+ local defaults = require("fzf-lua.defaults")+ local utils = require("fzf-lua.utils")++ local with_delta = function(fn)+ local executable = vim.fn.executable+ vim.fn.executable = function(bin)+ return bin == "delta" and 1 or executable(bin)+ end+ local ok, err = pcall(fn)+ vim.fn.executable = executable+ if not ok then error(err) end+ end++ it("uses $COLUMNS for skim", function()+ with_delta(function()+ local pager = defaults._preview_pager_fn({ __SK_VERSION = { 5, 6, 6 } })+ ---@cast pager string+ eq(type(pager), "string")+ eq(pager:find(utils._if_win_normalize_vars("$COLUMNS"), 1, true) ~= nil, true)+ eq(pager:find(utils._if_win_normalize_vars("$FZF_PREVIEW_COLUMNS"), 1, true), nil)+ end)+ end)++ it("uses $FZF_PREVIEW_COLUMNS for fzf", function()+ with_delta(function()+ local pager = defaults._preview_pager_fn({})+ ---@cast pager string+ eq(type(pager), "string")+ eq(pager:find(utils._if_win_normalize_vars("$FZF_PREVIEW_COLUMNS"), 1, true) ~= nil, true)+ eq(pager:find(utils._if_win_normalize_vars("$COLUMNS"), 1, true), nil)+ end)+ end)+end)