fix(ftb-tmux-popup): strip --tmux/--popup from FZF_DEFAULT_OPTS - #588
fix(ftb-tmux-popup): strip --tmux/--popup from FZF_DEFAULT_OPTS#588HaleTom wants to merge 6 commits into
Conversation
With use-fzf-default-opts yes, FZF_DEFAULT_OPTS is propagated into the popup env (upstream Aloxaf#509). If it contains --tmux or --popup, fzf opens a second (nested) popup inside the outer tmux popup -E, which flashes and closes, inserting the query text instead of showing matches. Strip --tmux/--popup (bare and =value forms) from the env value passed to fzf inside the popup. Keep --height/--layout and all other opts. Add 15 ztst cases covering bare/=value/mixed/separate-arg/empty inputs.
Verify stripped results contain zero elements (no '' placeholder) and kept args round-trip through %q unchanged.
--'has space' stays one element after (z) split; %q round-trips as --\'has space\' proving no '' placeholder is introduced.
${array:#pattern} filters the array as a whole and drops matching
elements — no loop, no function, no '' placeholder.
43ae2b0 to
462e6c3
Compare
egrep is obsolescent; use grep -E. The ztst run generates .zcompdump in the repo root; ignore it so it never gets committed.
Capture strip output to a var before (z)-split. (z)$(cmd) re-splits the command-substitution output and loses the quoting context, so --'has space' became 3 tokens. Capture-then-split preserves it as one token with the double space intact.
|
Two incidental test-hygiene changes in commit 1. - $(locale -a 2>/dev/null | egrep 'utf8|UTF-8'))
+ $(locale -a 2>/dev/null | grep -E 'utf8|UTF-8'))
2. *.zwc
+.zcompdumpThe Both are unrelated to the |
Fixes #587
Problem
ftb-tmux-popup(lib/ftb-tmux-popup:27) only strips--height*/--layout*fromfzf_opts. Withzstyle ':fzf-tab:*' use-fzf-default-opts yesandexport FZF_DEFAULT_OPTS='--tmux'(or--popup), the popup does a nested popup: outertmux popup -E(fromftb-tmux-popup) + innerfzf --tmuxpopup. Result: popup flashes and disappears, inserting the query text instead of showing matches.History: #455 reported
--tmuxinFZF_DEFAULT_OPTSbreaksftb-tmux-popup. #509 fixed it by propagatingFZF_DEFAULT_OPTSinto the popup (01dad759changedFZF_DEFAULT_OPTS=''→FZF_DEFAULT_OPTS=${(qq)FZF_DEFAULT_OPTS}), which re-exposes the nested-popup case.Fix
Strip
--tmux/--popup(bare and=valueforms) from theFZF_DEFAULT_OPTSenv value passed to fzf inside the popup. Keep--height/--layoutand all other opts.Note: filtering
fzf_optsis NOT sufficient — fzf-tab's ownfzf_optsnever contains--tmux/--popup; the nesting comes from theFZF_DEFAULT_OPTSenv propagated into the popup script (upstream #509). The env must be filtered.Tests
21 new ztst cases in
test/ftb-tmux-popup.ztstcovering:--tmux,--popup--tmux=center,50%,--popup=bottom,30%--height=40% --color=fg:1(others kept)--tmuxdoes not eat the next arg--popup=stripped among others--height 40%separate-arg kept,--tmuxstripped--tmuxand--popupstripped=valueforms strippedtmux=stripped''placeholder) — via$#_ron(z)-split result%qunchanged--'has space') stays one element after(z)split;%qround-trips as--\'has space\'proving no''placeholder is introducedVerified:
zsh +Z -f ./test/ztst.zsh test/ftb-tmux-popup.ztst→ all tests successful. Existingtest/fzftab.ztststill passes.Verification
Minimal zshrc + tmux 3.7b with attached client:
ls <TAB>→ popup flashes and disappears; buffer becomesls ls(query text inserted, no match list).env FZF_DEFAULT_OPTS=''in generated script.