Repository navigation
options(fix): Preserve user-option strings - #826
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #826 +/- ##
==========================================
+ Coverage 57.58% 58.08% +0.49%
==========================================
Files 29 29
Lines 4362 4416 +54
Branches 882 895 +13
==========================================
+ Hits 2512 2565 +53
- Misses 1539 1540 +1
Partials 311 311 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
tony
force-pushed
the
fix/759-user-options
branch
from
November 7, 2026 02:00
0d8c9fe to
55752f4
Compare
tony
force-pushed
the
fix/759-user-options
branch
3 times, most recently
from
November 21, 2026 22:10
d2349b0 to
d59eee9
Compare
tony
force-pushed
the
fix/759-user-options
branch
4 times, most recently
from
November 22, 2026 19:27
0997e92 to
78d60c4
Compare
tony
force-pushed
the
fix/759-user-options
branch
from
November 25, 2026 08:13
78d60c4 to
9374436
Compare
why: tmux stores user options as strings, but reading values such as "123" or "off" changed their types and broke round trips. what: - Preserve @ values in single and bulk option reads across scopes - Cover inherited reads and retain built-in option conversions - Document string results and explicit conversion for callers
why: show_option returned @ user options as integers or booleans and now returns the stored string. what: - Add a Breaking changes entry for user option values, with the migration
Decode tmux args_escape (utf8_strvis) sequences on @ user options before shlex.split so embedded newlines, tabs, quotes, and backslashes round-trip intact, and note tmux's named-only -A behavior for inherited user options.
why: parse_options_to_dict stripped trailing newlines after decoding @
user options, and tmux 3.4's server_client_print ran utf8_strvis without
VIS_DQ on show-options stdout, adding a second backslash before
$[A-Za-z_{] ("$HOME" read back as "\$HOME").
what:
- Strip at most one line-ending \n before decoding @ user-option lines
and restrict val.rstrip("\n") to the shlex ValueError fallback
- Decode backslash-run parity before $[A-Za-z_{] in
_unescape_user_option_value (2k + 1 from args_escape on 3.3a and 3.5+,
2k + 2 on tmux 3.4, ASCII C-locale letters only)
- Test round-trips across all scopes for trailing newlines, carriage
returns, 3-digit octal before digits, $VAR/\$VAR/$é/\$é, unset options
with and without ignore_errors=True, child include_inherited=True
reads, and standalone OptionsMixin subclasses
- Link OptionsMixin methods in MIGRATION and wrap options_and_hooks.md
to 80 columns
tony
force-pushed
the
fix/759-user-options
branch
from
November 27, 2026 01:26
544cfd5 to
78a4861
Compare
7 tasks done
tony
added a commit
to tmux-python/tmuxp
that referenced
this pull request
Nov 28, 2026
why: Pick up libtmux 0.69.0. Server context managers leave a running tmux server alive on exit unless kill_on_exit=True is set, @ user options stay strings in show_option() and show_options(), and empty tmux format fields hydrate as "" instead of None while unset fields stay None. tmuxp requires no source changes for the upgrade. what: - Bump libtmux ~=0.68.0 -> ~=0.69.0 in pyproject.toml - Update uv.lock to libtmux 0.69.0 from PyPI (only libtmux moves) libtmux 0.69.0 (2026-11-27): - Server.__exit__() preserves running servers unless kill_on_exit=True is set (tmux-python/libtmux#728) - @ user options stay strings in show_option() and show_options() (tmux-python/libtmux#826) - Empty tmux format fields hydrate as "" while unset fields stay None (tmux-python/libtmux#900) See also: - https://github.com/tmux-python/libtmux/releases/tag/v0.69.0 - https://libtmux.git-pull.com/history/#libtmux-0-69-0-2026-11-27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@user-option strings inshow_option()andshow_options(), including"123","on","off","", andstravis-escaped newlines, tabs, quotes, and backslashes.-Ainheritance rule indocs/topics/options_and_hooks.md,CHANGES, andMIGRATION.Fixes #759
Before / After
Before,
show_option()andshow_options()ranconvert_value()on@user options, turning"123","on", and"off"into123,True, andFalse:After,
@user options return the string tmux stores ("123"), and callers that want anintorboolconvert explicitly:Design decisions
cmd-set-option.c), every@option is stored viaoptions_set_stringacross all supported releases (3.3a+); skippingconvert_value()on@keys (including@name*inherited markers) preserves caller-supplied identifiers such as"007"or"on".cmd-show-options.candarguments.c,show-optionsformats string values through#{q/a:option_value}(args_escape/utf8_strvis), which escapes,, control bytes, and backslashes without adding outer quotes when no space or shell delimiter is present. Decodingargs_escapeon@option lines beforeshlex.splitkeeps multiline and tab-containing user options intact while leaving built-in option parsing unchanged.cmd-show-options.c,show-options -A <name>walks parent scopes for@options whereas bulkshow-options -Aonly walks local@entries;show_options()anddocs/topics/options_and_hooks.mdnote to passinclude_inherited=Truetoshow_option("@name", ...)when reading inherited user options.Test plan
test_custom_optionsverifiesshow_option(),show_options(), andshow_option(..., include_inherited=True)across server, session, window, and pane scopes for numeric, boolean-spelled, empty, whitespace, quote, backslash, and multiline/tab strings (verified failing on"a b"before_unescape_user_option_value)options.py,docs/topics/options_and_hooks.md, andMIGRATIONpassruff check,ruff format --check,mypy, andsphinx-build -W