Skip to content

Commit af94b48

Browse files
committed
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
1 parent 9752999 commit af94b48

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGES

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Python 2.7 support dropped.
1717
- :issue:`312`: ci: Add tmux 3.2a to CI
1818
- chore: Update black to `21.6b0
1919
<https://github.com/psf/black/blob/21.6b0/CHANGES.md#216b0>`_
20+
- :issue:`271`: Fix select_window() by providing the session ID as
21+
argument to -t.
2022

2123
libtmux 0.8.5 (2020-10-25)
2224
--------------------------

libtmux/session.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,10 @@ def select_window(self, target_window):
353353
assure ``-l``, ``-n``, ``-p`` work.
354354
"""
355355

356-
target = '-t%s' % target_window
356+
# Note that we also provide the session ID here, since cmd()
357+
# will not automatically add it as there is already a '-t'
358+
# argument provided.
359+
target = '-t%s:%s' % (self._session_id, target_window)
357360

358361
proc = self.cmd('select-window', target)
359362

0 commit comments

Comments
 (0)