Skip to content

Commit 509baed

Browse files
committed
Options(feat[pane]): Type 3.7 pane border styles
why: tmux 3.7 widened pane-active-border-style and pane-border-style from window-only to window+pane scope (options-table.c; set -p now round-trips). PaneOptions typed them only on WindowOptions, so the pane scope was unmodeled — the last tmux 3.7 option-scope gap. what: - Add pane_active_border_style / pane_border_style to PaneOptions (retained on WindowOptions; mirrors window_active_style/window_style) - Cover both with pane-scope set/show cases and the shared-fields guard - Note the scope widening in the CHANGES typed-options entry
1 parent b2dd930 commit 509baed

3 files changed

Lines changed: 31 additions & 5 deletions

File tree

‎CHANGES‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ The option dataclasses now type tmux 3.7's new options. On the server,
5555
the copy-mode line-number options, the tree-mode preview options and the
5656
window-pane status formats (of these, `tree-mode-preview-format` is also
5757
pane-scoped). The pane `remain-on-exit` option gained tmux 3.7's `key`
58-
value.
58+
value, and `pane-active-border-style` / `pane-border-style` (widened to
59+
pane scope in 3.7) now type on the pane too.
5960

6061
#### tmux 3.7 pane format variables (#694)
6162

‎src/libtmux/_internal/constants.py‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,14 @@ class PaneOptions(
257257
# tmux 3.5+ options
258258
pane_scrollbars: t.Literal["off", "modal", "on"] | None = field(default=None)
259259
pane_scrollbars_style: str | None = field(default=None)
260-
# tmux 3.7+ options. Only tree-mode-preview-format is window+pane scope;
261-
# the copy-mode, tree-mode-preview-style, and window-pane-status options
262-
# are window-only in tmux's options-table.c, so they live on WindowOptions.
260+
# tmux 3.7+ options. Among the new options only tree-mode-preview-format is
261+
# window+pane scope; the copy-mode, tree-mode-preview-style, and
262+
# window-pane-status options are window-only, so they live on WindowOptions.
263263
tree_mode_preview_format: str | None = field(default=None)
264+
# tmux 3.7 widened pane-active-border-style / pane-border-style from window
265+
# to window+pane scope (set -p now works), so they are typed on panes too.
266+
pane_active_border_style: str | None = field(default=None)
267+
pane_border_style: str | None = field(default=None)
264268

265269
def __init__(self, **kwargs: object) -> None:
266270
# Convert hyphenated keys to underscored attribute names and assign values

‎tests/test_options.py‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@
3030

3131

3232
# tmux 3.7's tree-mode-preview-format is the only new option scoped window+pane.
33-
TMUX_3_7_SHARED_PANE_OPTION_FIELDS = ("tree_mode_preview_format",)
33+
TMUX_3_7_SHARED_PANE_OPTION_FIELDS = (
34+
"tree_mode_preview_format",
35+
# pane-active-border-style / pane-border-style widened to window+pane in 3.7
36+
"pane_active_border_style",
37+
"pane_border_style",
38+
)
3439

3540
# tmux 3.7 options scoped window-only in options-table.c: they must NOT be typed
3641
# on PaneOptions (tmux's set -p silently routes them to the window).
@@ -1235,6 +1240,22 @@ class OptionTestCase(t.NamedTuple):
12351240
str,
12361241
"3.0",
12371242
),
1243+
OptionTestCase(
1244+
"pane_pane_active_border_style",
1245+
"pane-active-border-style",
1246+
OptionScope.Pane,
1247+
"fg=green",
1248+
str,
1249+
"3.7",
1250+
),
1251+
OptionTestCase(
1252+
"pane_pane_border_style",
1253+
"pane-border-style",
1254+
OptionScope.Pane,
1255+
"fg=red",
1256+
str,
1257+
"3.7",
1258+
),
12381259
]
12391260

12401261
# Combine all option test cases

0 commit comments

Comments
 (0)