From 727b40ac1019988a904fd4f05b51d6265c423559 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Thu, 21 Aug 2014 11:16:08 +0200 Subject: [PATCH] detect whether running tmux has a buggy swap-pane command see ticket #108, fixed in upstream commit 78e783e --- .tmux.conf | 10 +++++----- README.md | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index eaeca8e..1afca57 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -240,23 +240,23 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na # } # # maximize_pane() { -# tmux -V |grep -q '1.9a\?$' && tmux display "tmux 1.9 and 1.9a have a bug that prevent this feature from working" && return +# tmux -q -L swap-pane-test -f /dev/null new-session -d \; new-window \; new-window \; swap-pane -t :1 \; kill-session || { tmux display 'your tmux version has a buggy swap-pane command - see ticket #108, fixed in upstream commit 78e783e'; exit; } # __current_pane=$(tmux display -p '#{pane_id}') -# +# # __dead_panes=$(tmux list-panes -s -F '#{pane_dead} #{pane_id} #{pane_title}' | grep -o '^1 %.\+%.\+$' || true) # __restore=$(echo "${__dead_panes}" | sed -n -E -e "s/^1 ${__current_pane} \[\+\](%[0-9]+)$/tmux swap-pane -s \1 -t ${__current_pane} \; kill-pane -t ${__current_pane}/p" -e "s/^1 (%[0-9]+) \[\+\]${__current_pane}$/tmux swap-pane -s \1 -t ${__current_pane} \; kill-pane -t \1/p" ) -# +# # if [ x"${__restore}" = x ] ; then # [ x"$(tmux list-panes | wc -l | sed 's/^ *//g')" = x1 ] && tmux display "Can't maximize with only one pane" && return # __window=$(tmux new-window -P "exec maximized+ 2> /dev/null | tmux setw remain-on-exit on && printf '\033]2;%s\033\\' [+]${__current_pane}") # __window=${__window%.*} -# +# # __guard=100 # while ( [ x"$(tmux list-panes -t ${__window} -F '#{session_name}:#{window_index} #{pane_dead}')" != x"${__window} "1 ] && [ x"${__guard}" != x0 ] ) ; do sleep 0.01 ; _guard=$((__guard - 1)) ; done # if [ x"${__guard}" = 0 ] ; then # exit 1 # fi -# +# # __new_pane=$(tmux display -p '#{pane_id}') # tmux setw remain-on-exit off \; swap-pane -s "${__current_pane}" -t "${__new_pane}" # else diff --git a/README.md b/README.md index d82460b..f0eb47b 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,10 @@ Self-contained, opinionated `.tmux.conf` configuration file. The `master` branch targets tmux 1.9+. You may want to use the `1.7` or `1.8` branch. -**Please note that tmux 1.9 and 1.9a SEGFAULT when using the maximize pane -feature. As a consequence, the feature is disabled for those versions.** +**Please note that upstream tmux 1.9 and 1.9a SEGFAULT when using the maximize +pane feature. Some Linux distributions like Debian provide a patched tmux 1.9a. +Depending on whether or not the running tmux version has a buggy swap-pane +command, the maximize pane feature may be disabled.** Features --------