Skip to content

Commit 519e3a3

Browse files
committed
chore(Session.new_window): Restructure target condition
1 parent 12d4e68 commit 519e3a3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/libtmux/session.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -636,10 +636,6 @@ def new_window(
636636
if window_name is not None and isinstance(window_name, str):
637637
window_args += ("-n", window_name)
638638

639-
if window_index is not None:
640-
# empty string for window_index will use the first one available
641-
window_args += (f"-t{self.session_id}:{window_index}",)
642-
643639
if environment:
644640
if has_gte_version("3.0"):
645641
for k, v in environment.items():
@@ -664,6 +660,9 @@ def new_window(
664660
logger.warning(
665661
"Window target ignored, requires tmux 3.1 or newer.",
666662
)
663+
elif window_index is not None:
664+
# empty string for window_index will use the first one available
665+
window_args += (f"-t{self.session_id}:{window_index}",)
667666

668667
if window_shell:
669668
window_args += (window_shell,)

0 commit comments

Comments
 (0)