Skip to content

Integrate community fixes from 7 unmerged PRs#2

Merged
YedPool merged 11 commits into
mainfrom
integrate-community-fixes
Mar 13, 2026
Merged

Integrate community fixes from 7 unmerged PRs#2
YedPool merged 11 commits into
mainfrom
integrate-community-fixes

Conversation

@YedPool
Copy link
Copy Markdown
Owner

@YedPool YedPool commented Mar 13, 2026

Summary

Cherry-picks and integrates fixes from 7 unmerged upstream PRs:

Conflict Resolution

PR MLFlexer#130 and MLFlexer#136 both modified utils.lua. Resolved by keeping MLFlexer#136's comprehensive structure (parse_root, dir_is_accessible, mkdir_if_missing) but replacing shell_mkdir's os.execute with wezterm.run_child_process to avoid visible cmd.exe window flashes on Windows.

Test plan

  • Verify WezTerm loads plugin without errors (check debug overlay Ctrl+Shift+L)
  • Test save/restore on symmetric 2x2 pane layout
  • Test workspace name persists after restore
  • Test Windows path with drive letter (C:...) saves correctly
  • Verify no cmd.exe flickering on Windows startup

Generated with Claude Code

userux and others added 11 commits March 13, 2026 10:36
Add guard clause to skip panes that have already been processed by
another branch in symmetric layouts (e.g., perfect cross layout).
This prevents nil pane access errors when a pane appears in both
right and bottom branches.

Fixes MLFlexer#98
…truction

Covers the path handling behaviour added and fixed in the sibling commit:

ensure_folder_exists: nested creation, idempotency, spaces in directory
names, relative paths, the negative case where a file blocks a path
segment, and Windows-specific forms (absolute drive letter, drive-relative
C:foo normalisation). UNC paths are explicitly noted as untestable without
a live network share or privileged loopback.

state_manager get_file_path (exercised via load_state, which passes its
return value straight to file_io.load_json): separator between
save_state_dir and type, path separator sanitisation in file names, and
reserved character sanitisation (: [ ] ? /).

Also adds a Testing section to README.md documenting how to install Busted
via LuaRocks and run the suite, including Windows-specific notes about
using PowerShell and providing a GCC toolchain for native dependencies.
utils.lua — ensure_folder_exists:
- Removes the invalid /p flag on Windows mkdir and -p on Unix; the
  segment-by-segment loop makes both unnecessary.
- Fixes a gsub bug where the closing quote was inside the replacement
  string, corrupting any path containing a forward slash on Windows.
- Adds shell_mkdir with proper quoting: single-quote wrapping on Unix
  (neutralises spaces and most metacharacters), double-quote on Windows
  with rejection of " (not a valid NTFS filename character).
- Adds parse_root to handle all Windows path forms: absolute (C:\foo),
  drive-relative (C:foo normalised to C:\foo), and UNC (\server\share,
  supported only when the share already exists).
- Adds mkdir_if_missing to encapsulate the existence-check-then-create
  pattern, leaving ensure_folder_exists as a clean orchestrator.

state_manager.lua — get_file_path:
- Fixes a missing separator between save_state_dir and type in the format
  string, which produced paths like state_dir/name.json instead of
  state_dir/workspace/name.json.
- Expands filename sanitisation to cover Windows reserved characters
  (: [ ] ? /) in addition to the platform path separator.
WezTerm reports WSL pane working directories as /mnt/c/... (the WSL
mount path). The Windows mux rejects these when spawning restored panes
because they are not valid Windows paths.

Convert /mnt/<drive>/<rest> to <DRIVE>:\<rest> at save time so the
stored CWD is a Windows path the mux can validate. The existing
/C:/... -> C:\... strip is retained for native Windows panes.

Pure Linux paths (/home/...) remain unresolvable in a Windows mux
context and are left as-is.
…xecute` but `io.open` and `os.remove` on a tmp file as suggested by https://github.com/azinsharaf in MLFlexer#125 (comment) hopefully fixing MLFlexer#125 for all
…s` in `opts` for `dev.wezterm` plugin call `dev.setup(opts)` to work with local copy (and fork) - cf ChrisGVE/dev.wezterm#1
…uctural changes

Adds resurrect.state_manager.event_driven_save(opts) as a complement to
periodic_save. Instead of a timer, it saves whenever pane/tab structure
changes (detected via pane-focus-changed) and optionally on shell-reported
events via user-var-changed (e.g. directory changes with OSC 1337 shell
integration).

Also updates current_state on every save so that resurrect_on_gui_startup
always has a fresh workspace to restore.

Documents the new function, its opts, the shell integration pattern, and
the two new events in the README.
@YedPool YedPool merged commit 5af6ce9 into main Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants