Skip to content

Commit a800cbb

Browse files
committed
Pane(fix[display_popup]): -C closes existing popup, not close-on-success
why: The -C flag in tmux display-popup means "close any existing popup on the client" (server_client_clear_overlay), not "close on success exit code." The close-on-success behavior is achieved by passing -E twice (-EE), which sets POPUP_CLOSEEXITZERO in tmux's popup.c. what: - Fix close_on_success to emit -E -E instead of -C - Add close_existing parameter for the actual -C flag behavior - Update docstrings to document correct flag semantics
1 parent ee8e7bb commit a800cbb

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/libtmux/pane.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,7 @@ def display_popup(
11861186
*,
11871187
close_on_exit: bool | None = None,
11881188
close_on_success: bool | None = None,
1189+
close_existing: bool | None = None,
11891190
width: int | str | None = None,
11901191
height: int | str | None = None,
11911192
x: int | str | None = None,
@@ -1210,7 +1211,10 @@ def display_popup(
12101211
close_on_exit : bool, optional
12111212
Close popup when command exits (``-E`` flag).
12121213
close_on_success : bool, optional
1213-
Close popup only on success exit code (``-C`` flag).
1214+
Close popup only on success exit code (``-EE`` flag, passing ``-E``
1215+
twice).
1216+
close_existing : bool, optional
1217+
Close any existing popup on the client (``-C`` flag).
12141218
width : int or str, optional
12151219
Popup width (``-w`` flag).
12161220
height : int or str, optional
@@ -1249,11 +1253,14 @@ def display_popup(
12491253

12501254
tmux_args: tuple[str, ...] = ()
12511255

1256+
if close_existing:
1257+
tmux_args += ("-C",)
1258+
12521259
if close_on_exit:
12531260
tmux_args += ("-E",)
12541261

12551262
if close_on_success:
1256-
tmux_args += ("-C",)
1263+
tmux_args += ("-E", "-E")
12571264

12581265
if width is not None:
12591266
tmux_args += ("-w", str(width))

0 commit comments

Comments
 (0)