Skip to content

Commit 1ad3819

Browse files
committed
Window(fix[swap]): refresh self and target after swap-window
why: swap-window swaps window object pointers at tmux indices, changing window_index on both objects. Not refreshing leaves stale state, identical to the issue fixed in move_window by commit 3654a36. what: - Add self.refresh() after successful swap-window cmd - Refresh target Window if target is a Window instance - Remove manual refresh() calls from docstring examples (now automatic)
1 parent 8f30712 commit 1ad3819

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libtmux/window.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,8 +808,6 @@ def swap(
808808
>>> w1_idx = w1.window_index
809809
>>> w2_idx = w2.window_index
810810
>>> w1.swap(w2)
811-
>>> w1.refresh()
812-
>>> w2.refresh()
813811
>>> w1.window_index == w2_idx
814812
True
815813
>>> w2.window_index == w1_idx
@@ -828,6 +826,10 @@ def swap(
828826
if proc.stderr:
829827
raise exc.LibTmuxException(proc.stderr)
830828

829+
self.refresh()
830+
if isinstance(target, Window):
831+
target.refresh()
832+
831833
def rename_window(self, new_name: str) -> Window:
832834
"""Rename window.
833835

0 commit comments

Comments
 (0)