From 6258fbb48261aeb3efbe1b3c690a6a44969c108c Mon Sep 17 00:00:00 2001 From: Lawrence Chen <54008264+lawrencecchen@users.noreply.github.com> Date: Thu, 12 Mar 2026 03:50:53 -0700 Subject: [PATCH] tests: resolve zsh paths in redraw regressions --- docs/ghostty-fork.md | 5 +++-- ...hostty_zsh_prompt_redraw_uses_prompt_start.py | 9 +++++---- tests/test_ghostty_zsh_pure_preprompt_redraw.py | 16 +++++++++++++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/docs/ghostty-fork.md b/docs/ghostty-fork.md index 36189e2d..30ba29bf 100644 --- a/docs/ghostty-fork.md +++ b/docs/ghostty-fork.md @@ -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) diff --git a/tests/test_ghostty_zsh_prompt_redraw_uses_prompt_start.py b/tests/test_ghostty_zsh_prompt_redraw_uses_prompt_start.py index 7827265d..32ff0d64 100644 --- a/tests/test_ghostty_zsh_prompt_redraw_uses_prompt_start.py +++ b/tests/test_ghostty_zsh_prompt_redraw_uses_prompt_start.py @@ -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: diff --git a/tests/test_ghostty_zsh_pure_preprompt_redraw.py b/tests/test_ghostty_zsh_pure_preprompt_redraw.py index f59fe75e..ab916fe5 100644 --- a/tests/test_ghostty_zsh_pure_preprompt_redraw.py +++ b/tests/test_ghostty_zsh_pure_preprompt_redraw.py @@ -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)