Skip to content

Commit 39d20cc

Browse files
committed
options.py(fix[explode_arrays]): Preserve inherited marker in array keys
why: When tmux outputs inherited array options with -A flag (e.g., "status-format[0]*"), the asterisk was being stripped during explosion. This caused inconsistency: scalar inherited options preserved the "*" marker but array options did not. what: - Update regex to capture trailing "*" in new `inherited` group - Append "*" to base key when inherited marker is present - Ensures inherited array options like "status-format[0]*" produce "status-format*" keys, consistent with scalar inherited options
1 parent 18d9f80 commit 39d20cc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/libtmux/options.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,17 @@ def explode_arrays(
408408

409409
try:
410410
matchgroup = re.match(
411-
r"(?P<hook>[\w-]+)(\[(?P<index>\d+)\])?",
411+
r"(?P<option>[\w-]+)(\[(?P<index>\d+)\])?(?P<inherited>\*)?",
412412
key,
413413
)
414414
if matchgroup is not None:
415415
match = matchgroup.groupdict()
416-
if match.get("hook") and match.get("index"):
417-
key = match["hook"]
416+
if match.get("option") and match.get("index"):
417+
# Preserve inherited marker (*) if present
418+
base_key = match["option"]
419+
if match.get("inherited"):
420+
base_key += "*"
421+
key = base_key
418422
index = int(match["index"])
419423

420424
if options.get(key) is None:

0 commit comments

Comments
 (0)