fix(fzf): fall back to plain wrap on older fzf lacking wrap-word

wrap-word in --preview-window was added alongside bg-transform.
Reuse the existing _fzf_transform_action variable (already inherited
by fzf-history-widget) to select wrap-word on newer fzf and plain
wrap on older builds — no additional version check needed.
This commit is contained in:
2026-05-18 20:50:48 -04:00
parent 7acd099b3e
commit d7471e2eca
+4 -1
View File
@@ -213,10 +213,13 @@ function fzf_key_bindings
end
# Prepend the options to allow user customizations
# wrap-word requires the same newer fzf as bg-transform; fall back to plain wrap
set -l _fzf_wrap_opt wrap
test "$_fzf_transform_action" = bg-transform; and set _fzf_wrap_opt wrap-word
set -p -- FZF_DEFAULT_OPTS \
'--bind="focus,resize:'$_fzf_transform_action':if test \\"$FZF_COLUMNS\\" -gt 100 -a \\\\( \\"$FZF_SELECT_COUNT\\" -gt 0 -o \\\\( -z \\"$FZF_WRAP\\" -a (string length -- {}) -gt (math $FZF_COLUMNS - 4) \\\\) -o (string collect -- {2..} | fish_indent | count) -gt 1 \\\\); echo show-preview; else echo hide-preview; end"' \
'--preview="string collect -- (test \\"$FZF_SELECT_COUNT\\" -gt 0; and string collect -- {+2..}) \\"\\n# \\"'$date_cmd' {2..} | fish_indent --ansi"' \
'--preview-window="right,50%,wrap-word,follow,info,hidden"'
'--preview-window="right,50%,'$_fzf_wrap_opt',follow,info,hidden"'
end
set -lx FZF_DEFAULT_OPTS_FILE