tests: resolve zsh paths in redraw regressions

This commit is contained in:
Lawrence Chen 2026-03-12 03:50:53 -07:00
parent 4d04723600
commit 6258fbb482
3 changed files with 21 additions and 9 deletions

View file

@ -45,8 +45,9 @@ Fork rebased onto upstream `v1.3.0` plus newer `main` commits as of March 12, 20
### 4) macOS resize stale-frame mitigation
Sections 3 and 4 are grouped by feature, not by commit order. The fork branch HEAD is the
section 3 copy-mode commit, even though the section 4 resize commits were applied earlier.
Sections 3 and 4 are grouped by feature, not by commit order. The section 4 resize commits were
applied earlier than the section 3 copy-mode commit, but they are kept together here because they
touch the same stale-frame mitigation path and tend to conflict in the same files during rebases.
- Commits:
- `769bbf7a9` (macos: reduce transient blank/scaled frames during resize)

View file

@ -73,10 +73,10 @@ zle -N zle-line-init _cmux_redraw_line_init
)
def _capture_session(env: dict[str, str]) -> bytes:
def _capture_session(env: dict[str, str], zsh_path: str) -> bytes:
master, slave = pty.openpty()
proc = subprocess.Popen(
["zsh", "-d", "-i"],
[zsh_path, "-d", "-i"],
stdin=slave,
stdout=slave,
stderr=slave,
@ -123,7 +123,8 @@ def main() -> int:
print(f"SKIP: missing Ghostty zsh wrapper at {wrapper_dir}")
return 0
if shutil.which("zsh") is None:
zsh_path = shutil.which("zsh")
if zsh_path is None:
print("SKIP: zsh not installed")
return 0
@ -141,7 +142,7 @@ def main() -> int:
env.pop("GHOSTTY_SHELL_FEATURES", None)
env.pop("GHOSTTY_BIN_DIR", None)
output = _capture_session(env)
output = _capture_session(env, zsh_path)
marker = output.find(END_COMMAND)
if marker == -1:

View file

@ -89,7 +89,14 @@ PROMPT='%F{5}%f '
_ANSI_RE = re.compile(rb"\x1b\][^\x07]*\x07|\x1b\[[0-9;?]*[ -/]*[@-~]|\r")
def _capture_session(*, use_ghostty: bool, wrapper_dir: Path, resources_dir: Path, workdir: Path) -> str:
def _capture_session(
*,
use_ghostty: bool,
wrapper_dir: Path,
resources_dir: Path,
workdir: Path,
zsh_path: str,
) -> str:
base = Path(tempfile.mkdtemp(prefix="cmux_ghostty_pure_preprompt_"))
try:
home = base / "home"
@ -112,7 +119,7 @@ def _capture_session(*, use_ghostty: bool, wrapper_dir: Path, resources_dir: Pat
master, slave = pty.openpty()
proc = subprocess.Popen(
["zsh", "-d", "-i"],
[zsh_path, "-d", "-i"],
cwd=str(workdir),
stdin=slave,
stdout=slave,
@ -174,7 +181,8 @@ def main() -> int:
if not (wrapper_dir / ".zshenv").exists():
print(f"SKIP: missing Ghostty zsh wrapper at {wrapper_dir}")
return 0
if shutil.which("zsh") is None:
zsh_path = shutil.which("zsh")
if zsh_path is None:
print("SKIP: zsh not installed")
return 0
@ -186,12 +194,14 @@ def main() -> int:
wrapper_dir=wrapper_dir,
resources_dir=resources_dir,
workdir=workdir,
zsh_path=zsh_path,
)
ghostty = _capture_session(
use_ghostty=True,
wrapper_dir=wrapper_dir,
resources_dir=resources_dir,
workdir=workdir,
zsh_path=zsh_path,
)
plain_stale, plain_async = _stale_preprompt_lines(plain, path_line, async_line)