1
0
Fork 0
mirror of synced 2024-09-07 18:32:19 -04:00

detect whether running tmux has a buggy swap-pane command

see ticket #108, fixed in upstream commit 78e783e
This commit is contained in:
Gregory Pakosz 2014-08-21 11:16:08 +02:00
parent cfea776923
commit 727b40ac10
2 changed files with 9 additions and 7 deletions

View file

@ -240,23 +240,23 @@ run 'for name in $(printenv | grep -Eo ^tmux_conf_[^=]+); do tmux setenv -gu $na
# } # }
# #
# maximize_pane() { # 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}') # __current_pane=$(tmux display -p '#{pane_id}')
# #
# __dead_panes=$(tmux list-panes -s -F '#{pane_dead} #{pane_id} #{pane_title}' | grep -o '^1 %.\+%.\+$' || true) # __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" ) # __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 # 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 # [ 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=$(tmux new-window -P "exec maximized+ 2> /dev/null | tmux setw remain-on-exit on && printf '\033]2;%s\033\\' [+]${__current_pane}")
# __window=${__window%.*} # __window=${__window%.*}
# #
# __guard=100 # __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 # 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 # if [ x"${__guard}" = 0 ] ; then
# exit 1 # exit 1
# fi # fi
# #
# __new_pane=$(tmux display -p '#{pane_id}') # __new_pane=$(tmux display -p '#{pane_id}')
# tmux setw remain-on-exit off \; swap-pane -s "${__current_pane}" -t "${__new_pane}" # tmux setw remain-on-exit off \; swap-pane -s "${__current_pane}" -t "${__new_pane}"
# else # else

View file

@ -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` The `master` branch targets tmux 1.9+. You may want to use the `1.7` or `1.8`
branch. branch.
**Please note that tmux 1.9 and 1.9a SEGFAULT when using the maximize pane **Please note that upstream tmux 1.9 and 1.9a SEGFAULT when using the maximize
feature. As a consequence, the feature is disabled for those versions.** 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 Features
-------- --------