Skip to content

Commit a0a77d2

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 84c7c3e commit a0a77d2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGES

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Here you can find the recent changes to libtmux
77
current
88
-------
99
- *Insert changes/features/fixes for next release here*
10+
- :issue:`271`: Fix select_window() by providing the session ID as
11+
argument to -t.
12+
1013

1114
libtmux 0.8.5 (2020-10-25)
1215
--------------------------

libtmux/session.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,10 @@ def select_window(self, target_window):
357357
assure ``-l``, ``-n``, ``-p`` work.
358358
"""
359359

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

362365
proc = self.cmd('select-window', target)
363366

0 commit comments

Comments
 (0)