From 34c064e4926610b80b9d44eb9a8ca3be13d1db7c Mon Sep 17 00:00:00 2001 From: "zero@thinky" Date: Fri, 4 Jul 2025 16:57:01 +0300 Subject: [PATCH 1/2] fix #13: handle nonzero base-index --- tmex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tmex b/tmex index 02f0556..cad18cb 100755 --- a/tmex +++ b/tmex @@ -1241,8 +1241,8 @@ For complete documentation, please see https://github.com/evnp/tmex#readme' # --- Multi-Window Management --- # args=("${@:-}") tmexargs=() - nextwindowidx=0 - focuswindowidx=0 + nextwindowidx=$(tmux show -Av base-index) + focuswindowidx=$nextwindowidx for (( idx = 0; idx <= ${#args[@]}; idx++ )) do if (( idx == ${#args[@]} )) || [[ "${args[idx]}" =~ ^(-w|-W|--window|--window-focus) ]] From b8df41482fe0d3da7489a23aaab69d29154025a9 Mon Sep 17 00:00:00 2001 From: "zero@thinky" Date: Sat, 5 Jul 2025 06:45:30 +0300 Subject: [PATCH 2/2] make tests pass with #13 fixes; fix code style --- tmex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tmex b/tmex index cad18cb..6a16383 100755 --- a/tmex +++ b/tmex @@ -1241,8 +1241,9 @@ For complete documentation, please see https://github.com/evnp/tmex#readme' # --- Multi-Window Management --- # args=("${@:-}") tmexargs=() - nextwindowidx=$(tmux show -Av base-index) - focuswindowidx=$nextwindowidx + nextwindowidx="$( tmux show-options -Av base-index 2>/dev/null )" + ! [[ "${nextwindowidx}" =~ ^[0-9]+$ ]] && nextwindowidx=0 + focuswindowidx="${nextwindowidx}" for (( idx = 0; idx <= ${#args[@]}; idx++ )) do if (( idx == ${#args[@]} )) || [[ "${args[idx]}" =~ ^(-w|-W|--window|--window-focus) ]]