diff --git a/.github/tmux-releases.toml b/.github/tmux-releases.toml index d0c5852cbb..84f3ce0903 100644 --- a/.github/tmux-releases.toml +++ b/.github/tmux-releases.toml @@ -6,5 +6,5 @@ "3.4" = "551ab8dea0bf505c0ad6b7bb35ef567cdde0ccb84357df142c254f35a23e19aa" "3.5" = "2fe01942e7e7d93f524a22f2c883822c06bc258a4d61dba4b407353d7081950f" "3.6" = "136db80cfbfba617a103401f52874e7c64927986b65b1b700350b6058ad69607" -"3.7" = "2344f191501b8a73eb71dd6c5fd5dcf8c765f5066f34ab46f04b3013dc7bc1a5" +"3.7c" = "7c60cae9a0e25288e2e24750aafc9e8800fc7fd4555e447e1b29ee4201cfb3bf" "3.8" = "e79c699c7e949dccd0a4a125e17b8d1261e311b16979dbc8eb34542f3966d82e" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e6b895c7c4..69870c14f4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,9 +9,10 @@ jobs: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: python-version: ['3.15'] - tmux-version: ['3.3a', '3.4', '3.5', '3.6', '3.7', '3.8', 'master'] + tmux-version: ['3.3a', '3.4', '3.5', '3.6', '3.7c', '3.8', 'master'] steps: - uses: actions/checkout@v7 diff --git a/CHANGES b/CHANGES index 003a1a065d..40e8072979 100644 --- a/CHANGES +++ b/CHANGES @@ -44,6 +44,102 @@ $ tmuxp@next load yoursession _Notes on the upcoming release will go here._ +### Breaking changes + +#### `tmuxp freeze` keeps window `@` user options as strings (#1113) + +`tmuxp freeze` now writes window `@` user options as strings instead of +converting numeric and boolean-looking values to integers or booleans, and +writes an unnamed window (`rename-window ""`) as `window_name: ''` instead of +`window_name: null`. On `tmuxp load`, string option values pass through `$VAR` +and `~` expansion, and frozen unnamed windows reload without raising +`TypeError`. + +Given a live window renamed to `""` with `@badge` set to `007` and `@enabled` +set to `on`: + +```console +$ tmux rename-window "" && \ + tmux set-option -w @badge 007 && \ + tmux set-option -w @enabled on +``` + +Before, `tmuxp freeze` converted `@badge` to `7` (dropping its leading zeros), +`@enabled` to `true`, and the unnamed window to `null`: + +```yaml +windows: + - window_name: null + options: + '@badge': 7 + '@enabled': true +``` + +Now, `tmuxp freeze` keeps `@` options as strings and writes the unnamed window +as `''`: + +```yaml +windows: + - window_name: '' + options: + '@badge': '007' + '@enabled': 'on' +``` + +This comes from libtmux 0.69.0. Unpatched tmux 3.7 rejects empty window names +(`""`), `:` and `.` in session and window names; use tmux 3.7a or newer (3.7c +is the latest 3.7 patch release). + +### Dependencies + +#### Minimum `libtmux~=0.69.0` (was `~=0.68.0`) (#1113) + +Picks up libtmux 0.69.0. `with Server()` leaves a running tmux server alive on +exit unless `Server(..., 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`. See the +[libtmux 0.69.0 release notes](https://libtmux.git-pull.com/history/#libtmux-0-69-0-2026-11-27). + +### Development + +#### CI exercises tmux 3.7c instead of unpatched 3.7 (#1113) + +CI replaces the unpatched tmux 3.7 release (2026-06-26) with 3.7c (2026-08-17, +the latest 3.7 patch release) in `.github/workflows/tests.yml` and +`.github/tmux-releases.toml`, and sets `fail-fast: false` so every matrix leg +runs to completion. + +Unpatched tmux 3.7 shipped four regressions fixed five days later in 3.7a +(2026-07-01), followed by additional fixes in 3.7b and 3.7c: + +- Empty window and session names (`""`) fail with `invalid window name:` or + `invalid session name:` because `check_name()` and `clean_name()` reject + `*name == '\0'` in + [`tmux.c`](https://github.com/tmux/tmux/blob/3.7/tmux.c#L284-L318), blocking + `rename-window ""` + ([`cmd-rename-window.c`](https://github.com/tmux/tmux/blob/3.7/cmd-rename-window.c#L53-L58)) + and `new-window -n ""` when loading `window_name: ''` + ([`cmd-new-window.c`](https://github.com/tmux/tmux/blob/3.7/cmd-new-window.c#L73-L83)). +- `:` and `.` in session, session-group, and window names fail with + `invalid session name:` or `invalid window name:` via `WINDOW_NAME_FORBID` and + `SESSION_NAME_FORBID` in + [`tmux.h`](https://github.com/tmux/tmux/blob/3.7/tmux.h#L99-L103) and + [`cmd-new-session.c`](https://github.com/tmux/tmux/blob/3.7/cmd-new-session.c#L102-L121), + breaking workspaces named like `my.project` or `v1.0`. +- `#[` style directives in `automatic-rename-format` and escape-set titles are + rewritten to `_` via `WINDOW_NAME_FORBID_EXT` (`":.#"`) in + [`tmux.c`](https://github.com/tmux/tmux/blob/3.7/tmux.c#L292-L295); + [`tmux 3.7a`](https://github.com/tmux/tmux/blob/3.7a/tmux.c#L284-L307) + restricts `#` scrubbing to untrusted `#(` shell commands and restores `:`, + `.` and `""`. +- `break-pane` without `-n` dereferences `NULL` and crashes the tmux server due + to an inverted `if (name != NULL)` guard in + [`cmd-break-pane.c`](https://github.com/tmux/tmux/blob/3.7/cmd-break-pane.c#L117-L124). +- [`tmux 3.7b`](https://github.com/tmux/tmux/blob/3.7b/input.c#L1956-L1960) + restores `PANE_REDRAW` at the end of a synchronized update (`CSI ? 2026 l`), + and `3.7c` fixes unzooming before creating a floating pane and new-window + scrollbar initialization. + ## tmuxp 1.82.0 (2026-11-24) tmuxp 1.82.0 updates libtmux to 0.68.0. When an earlier entry in a pane's diff --git a/pyproject.toml b/pyproject.toml index b9ad120a2a..29a96fb716 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ include = [ { path = "conftest.py", format = "sdist" }, ] dependencies = [ - "libtmux~=0.68.0", + "libtmux~=0.69.0", "PyYAML>=6.0" ] diff --git a/tests/workspace/test_freezer.py b/tests/workspace/test_freezer.py index 653db9a08c..539556ef62 100644 --- a/tests/workspace/test_freezer.py +++ b/tests/workspace/test_freezer.py @@ -10,7 +10,7 @@ from tests.fixtures import utils as test_utils from tmuxp._internal.config_reader import ConfigReader -from tmuxp.workspace import freezer, validation +from tmuxp.workspace import freezer, loader, validation from tmuxp.workspace.builder import WorkspaceBuilder if typing.TYPE_CHECKING: @@ -133,3 +133,26 @@ def test_freeze_logs_debug( window_records = [r for r in caplog.records if r.msg == "frozen window"] assert len(window_records) >= 1 assert hasattr(window_records[0], "tmux_window") + + +def test_freeze_preserves_window_user_options_and_empty_name( + session: Session, +) -> None: + """Freeze window @ user options as strings and empty window names as ''.""" + window = session.active_window + window.set_option("automatic-rename", "off") + window.rename_window("") + window.set_option("@badge", "007") + window.set_option("@enabled", "on") + + frozen = freezer.freeze(session) + validation.validate_schema(frozen) + + yaml_text = ConfigReader._dump(fmt="yaml", content=frozen) + reloaded = ConfigReader._load(fmt="yaml", content=yaml_text) + expanded = loader.expand(reloaded) + + frozen_window = expanded["windows"][0] + assert frozen_window["window_name"] == "" + assert frozen_window["options"]["@badge"] == "007" + assert frozen_window["options"]["@enabled"] == "on" diff --git a/uv.lock b/uv.lock index 32e1a4111a..1e6e64c3ba 100644 --- a/uv.lock +++ b/uv.lock @@ -709,11 +709,11 @@ wheels = [ [[package]] name = "libtmux" -version = "0.68.0" +version = "0.69.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/d9/87/2f05a4cd7f89d4951db975be2c627ccc8ac2d0fe1a4b0ac819c49450fe66/libtmux-0.68.0.tar.gz", hash = "sha256:730bff45c4dcfb4d2094a863d28d88aca81d6d8de6c1f47a79f0ed6a2a18be4a", size = 717849, upload-time = "2026-11-25T01:20:41.288Z" } +sdist = { url = "https://files.pythonhosted.org/packages/75/96/f2b02bae053cf269af7296a881cf3dda96789e10d52d6351a141d50e1688/libtmux-0.69.0.tar.gz", hash = "sha256:44ec3c985884aed01351a26db10da4ddcec9ef0ff9dfe2fb55fefc597ac76a59", size = 724881, upload-time = "2026-11-28T00:47:03.346Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/c8/c6/640b4241be4c955abb44da700d15773ead95a181e8533b03040a17447d1e/libtmux-0.68.0-py3-none-any.whl", hash = "sha256:348f6de3f681a22f0d702a1f669c474428b2f3e440a75cae772cde86fb08b9b9", size = 162976, upload-time = "2026-11-25T01:20:38.768Z" }, + { url = "https://files.pythonhosted.org/packages/17/b6/7d0129ba159838073fea28ffa2155638c37b77254240691aa4983bb7d5e4/libtmux-0.69.0-py3-none-any.whl", hash = "sha256:2179066ceecb45706b3f017e88e5a2c6bbfa52738810f61fbab66e695f4e9fae", size = 165059, upload-time = "2026-11-28T00:47:02.039Z" }, ] [[package]] @@ -1612,7 +1612,7 @@ testing = [ [package.metadata] requires-dist = [ - { name = "libtmux", specifier = "~=0.68.0" }, + { name = "libtmux", specifier = "~=0.69.0" }, { name = "pyyaml", specifier = ">=6.0" }, ]