From af94b4866559f8ffe86e2514768de69615e87607 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 19 Mar 2020 12:25:27 +0100 Subject: [PATCH] Fix select_window() by providing the session ID as argument to -t Previosly select_window() would not work in nested tmux scenarios, as there was no tmux session ID in the final tmux command. This is because select_window() already adds the '-t' argument, hence the check in cmd() does not add the session ID. Thanks to Fabian Lesniak and Andreas Fried for pointing this out. Fixes #161 --- CHANGES | 2 ++ libtmux/session.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index ee9b8d8dc..0b31563a7 100644 --- a/CHANGES +++ b/CHANGES @@ -17,6 +17,8 @@ Python 2.7 support dropped. - :issue:`312`: ci: Add tmux 3.2a to CI - chore: Update black to `21.6b0 `_ +- :issue:`271`: Fix select_window() by providing the session ID as + argument to -t. libtmux 0.8.5 (2020-10-25) -------------------------- diff --git a/libtmux/session.py b/libtmux/session.py index 5c3997266..0b19268bc 100644 --- a/libtmux/session.py +++ b/libtmux/session.py @@ -353,7 +353,10 @@ def select_window(self, target_window): assure ``-l``, ``-n``, ``-p`` work. """ - target = '-t%s' % target_window + # Note that we also provide the session ID here, since cmd() + # will not automatically add it as there is already a '-t' + # argument provided. + target = '-t%s:%s' % (self._session_id, target_window) proc = self.cmd('select-window', target)