Skip to content

Commit ace77b9

Browse files
committed
Window(fix[rotate]): don't always inject -D, respect tmux default
why: rotate-window with no flags defaults to upward rotation in tmux (cmd-rotate-window.c:82). The code always injected -D in the else branch, making rotate() behave as downward instead of tmux's default. what: - Replace direction_up with separate upward/downward params - Only send -U/-D when explicitly requested - No flags sent by default (tmux default = upward)
1 parent 4594d56 commit ace77b9

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/libtmux/window.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -693,15 +693,18 @@ def unlink(self, *, kill_if_last: bool | None = None) -> None:
693693
def rotate(
694694
self,
695695
*,
696-
direction_up: bool | None = None,
696+
upward: bool | None = None,
697+
downward: bool | None = None,
697698
keep_zoom: bool | None = None,
698699
) -> Window:
699700
"""Rotate pane positions in the window via ``$ tmux rotate-window``.
700701
701702
Parameters
702703
----------
703-
direction_up : bool, optional
704-
Rotate upward (``-U`` flag). Default is downward (``-D``).
704+
upward : bool, optional
705+
Rotate upward (``-U`` flag).
706+
downward : bool, optional
707+
Rotate downward (``-D`` flag).
705708
keep_zoom : bool, optional
706709
Keep the window zoomed if zoomed (``-Z`` flag).
707710
@@ -719,9 +722,10 @@ def rotate(
719722
"""
720723
tmux_args: tuple[str, ...] = ()
721724

722-
if direction_up:
725+
if upward:
723726
tmux_args += ("-U",)
724-
else:
727+
728+
if downward:
725729
tmux_args += ("-D",)
726730

727731
if keep_zoom:

0 commit comments

Comments
 (0)