Skip to content

Commit ca6eaba

Browse files
committed
Pane(fix[display_message]): no_expand→-l (literal), remove wrong list_formats
why: -I opens pane stdin input mode (window_pane_start_input), not suppress expansion. -l (tmux 3.4, commit 3be36952) is the correct literal flag. list_formats mapped to -l with doc "List format variables" — but -l suppresses expansion, not lists variables; -a (all_formats) already covers listing, making list_formats a wrong duplicate. what: - Fix no_expand to emit -l with has_gte_version("3.4") guard + warn on older - Remove list_formats param from both overloads, implementation, and docstring - Update no_expand docstring: "-l flag. Requires tmux 3.4+" - Remove list_formats test case; add no_expand test verifying literal output
1 parent c49eb53 commit ca6eaba

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

src/libtmux/pane.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,6 @@ def display_message(
593593
target_client: str | None = ...,
594594
delay: int | None = ...,
595595
notify: bool | None = ...,
596-
list_formats: bool | None = ...,
597596
no_style: bool | None = ...,
598597
) -> list[str]: ...
599598

@@ -610,7 +609,6 @@ def display_message(
610609
target_client: str | None = ...,
611610
delay: int | None = ...,
612611
notify: bool | None = ...,
613-
list_formats: bool | None = ...,
614612
no_style: bool | None = ...,
615613
) -> None: ...
616614

@@ -626,7 +624,6 @@ def display_message(
626624
target_client: str | None = None,
627625
delay: int | None = None,
628626
notify: bool | None = None,
629-
list_formats: bool | None = None,
630627
no_style: bool | None = None,
631628
) -> list[str] | None:
632629
"""Display message to pane.
@@ -655,7 +652,8 @@ def display_message(
655652
656653
.. versionadded:: 0.45
657654
no_expand : bool, optional
658-
Suppress format expansion (``-I`` flag).
655+
Suppress format expansion; output is returned as a literal string
656+
(``-l`` flag). Requires tmux 3.4+.
659657
660658
.. versionadded:: 0.45
661659
target_client : str, optional
@@ -669,10 +667,6 @@ def display_message(
669667
notify : bool, optional
670668
Do not wait for input (``-N`` flag).
671669
672-
.. versionadded:: 0.45
673-
list_formats : bool, optional
674-
List format variables (``-l`` flag). Requires tmux 3.4+.
675-
676670
.. versionadded:: 0.45
677671
no_style : bool, optional
678672
Suppress style output (``-C`` flag). Requires tmux 3.6+.
@@ -700,20 +694,17 @@ def display_message(
700694
tmux_args += ("-v",)
701695

702696
if no_expand:
703-
tmux_args += ("-I",)
704-
705-
if notify:
706-
tmux_args += ("-N",)
707-
708-
if list_formats:
709697
if has_gte_version("3.4", tmux_bin=self.server.tmux_bin):
710698
tmux_args += ("-l",)
711699
else:
712700
warnings.warn(
713-
"list_formats requires tmux 3.4+, ignoring",
701+
"no_expand requires tmux 3.4+, ignoring",
714702
stacklevel=2,
715703
)
716704

705+
if notify:
706+
tmux_args += ("-N",)
707+
717708
if no_style:
718709
if has_gte_version("3.6", tmux_bin=self.server.tmux_bin):
719710
tmux_args += ("-C",)

tests/test_pane.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -677,10 +677,12 @@ class DisplayMessageCase(t.NamedTuple):
677677
min_tmux_version=None,
678678
),
679679
DisplayMessageCase(
680-
test_id="list_formats",
681-
cmd="",
682-
kwargs={"get_text": True, "list_formats": True},
683-
expected_in_output=None,
680+
test_id="no_expand",
681+
cmd="#{pane_id}",
682+
# no_expand=True → -l flag: output should be the literal string, not
683+
# the expanded pane id (which would start with %)
684+
kwargs={"get_text": True, "no_expand": True},
685+
expected_in_output="#{pane_id}",
684686
min_tmux_version="3.4",
685687
),
686688
]

0 commit comments

Comments
 (0)