From 6a6130615d600a1dd23bbb6916e386520eaeb6b2 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sat, 6 Aug 2022 19:01:08 +0900 Subject: [PATCH] [fzf-tmux] Remove code for tmux 3.2 beta compatibility --- bin/fzf-tmux | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/bin/fzf-tmux b/bin/fzf-tmux index 6a18cf8a..92c3f66d 100755 --- a/bin/fzf-tmux +++ b/bin/fzf-tmux @@ -58,7 +58,7 @@ while [[ $# -gt 0 ]]; do ;; -p*|-w*|-h*|-x*|-y*|-d*|-u*|-r*|-l*) if [[ "$arg" =~ ^-[pwhxy] ]]; then - [[ "$opt" =~ "-K -E" ]] || opt="-K -E" + [[ "$opt" =~ "-E" ]] || opt="-E" elif [[ "$arg" =~ ^.[lr] ]]; then opt="-h" if [[ "$arg" =~ ^.l ]]; then @@ -139,7 +139,7 @@ fi args=("${args[@]}" "--no-height" "--bind=ctrl-z:ignore") # Handle zoomed tmux pane without popup options by moving it to a temp window -if [[ ! "$opt" =~ "-K -E" ]] && tmux list-panes -F '#F' | grep -q Z; then +if [[ ! "$opt" =~ "-E" ]] && tmux list-panes -F '#F' | grep -q Z; then zoomed_without_popup=1 original_window=$(tmux display-message -p "#{window_id}") tmp_window=$(tmux new-window -d -P -F "#{window_id}" "bash -c 'while :; do for c in \\| / - '\\;' do sleep 0.2; printf \"\\r\$c fzf-tmux is running\\r\"; done; done'") @@ -181,7 +181,7 @@ trap 'cleanup 1' SIGUSR1 trap 'cleanup' EXIT envs="export TERM=$TERM " -[[ "$opt" =~ "-K -E" ]] && FZF_DEFAULT_OPTS="--margin 0,1 $FZF_DEFAULT_OPTS" +[[ "$opt" =~ "-E" ]] && FZF_DEFAULT_OPTS="--margin 0,1 $FZF_DEFAULT_OPTS" [[ -n "$FZF_DEFAULT_OPTS" ]] && envs="$envs FZF_DEFAULT_OPTS=$(printf %q "$FZF_DEFAULT_OPTS")" [[ -n "$FZF_DEFAULT_COMMAND" ]] && envs="$envs FZF_DEFAULT_COMMAND=$(printf %q "$FZF_DEFAULT_COMMAND")" echo "$envs;" > "$argsf" @@ -195,7 +195,7 @@ close="; trap - EXIT SIGINT SIGTERM $close" export TMUX=$(cut -d , -f 1,2 <<< "$TMUX") mkfifo -m o+w $fifo2 -if [[ "$opt" =~ "-K -E" ]]; then +if [[ "$opt" =~ "-E" ]]; then cat $fifo2 & if [[ -n "$term" ]] || [[ -t 0 ]]; then cat <<< "\"$fzf\" $opts > $fifo2; out=\$? $close; exit \$out" >> $argsf @@ -205,14 +205,6 @@ if [[ "$opt" =~ "-K -E" ]]; then cat <&0 > $fifo1 & fi - # tmux dropped the support for `-K`, `-R` to popup command - # TODO: We can remove this once tmux 3.2 is released - if [[ ! "$(tmux popup --help 2>&1)" =~ '-R shell-command' ]]; then - opt="${opt/-K/}" - else - opt="${opt} -R" - fi - tmux popup -d "$PWD" "${tmux_args[@]}" $opt "bash $argsf" > /dev/null 2>&1 exit $? fi