Skip to content

fix(windows): quote diff-pane argv so git receives the delta pager intact#49

Merged
mathix420 merged 1 commit into
masterfrom
windows-fixes
Jun 12, 2026
Merged

fix(windows): quote diff-pane argv so git receives the delta pager intact#49
mathix420 merged 1 commit into
masterfrom
windows-fixes

Conversation

@mathix420

Copy link
Copy Markdown
Owner

Why diffs still failed on Windows

#43's follow-up (f4ac7a4, shipped in v0.2.9) replaced the sh -c '… | delta' pipe with git -c "core.pager=delta --paging=always" diff …, which is correct — but on Windows alacritty_terminal flattens PTY argv into a single CreateProcess command line and only quotes arguments when Options::escape_args is set. We left it at the default false, so the command line came out as:

git -c core.pager=delta --paging=always diff -- <file>

The pager spec split on its internal space, git rejected --paging=always as an unknown global option and exited instantly, and reap_exited_sessions closed the pane the same frame — the diff panel "opened" and auto-closed without rendering anything. Any file path containing a space would have split identically.

Fix

Set escape_args: true for diff-pane sessions, whose argv is constructed in code and therefore carries logical arguments that must survive intact. Config-shell args from alacritty.toml stay raw (false), matching how upstream alacritty treats user-authored shell arguments on Windows.

No behavior change on unix: the field is #[cfg(windows)]-gated and unix PTYs exec a real argv.

Testing

  • cargo check -p alacritree and cargo fmt clean on Linux; the Windows-gated field matches alacritty_terminal::tty::Options exactly (same pattern as its own test_cmdline, which asserts escape_args: true produces echo "hello world").
  • Needs a Windows smoke test after merge: click staged/unstaged/untracked files and the branch diff row in the right sidebar; each should open delta in the pane instead of flashing closed.

🤖 Generated with Claude Code

…tact

The previous Windows diff fix moved delta into git's pager
(`-c core.pager=delta --paging=always`), but alacritty_terminal joins
PTY argv into a single CreateProcess command line and only quotes
arguments when `Options::escape_args` is set — and we left it at the
default `false`. The pager spec split on its space, git rejected
`--paging=always` as an unknown global option and exited immediately,
and the reaper closed the pane before the error could render: the diff
"opened" and vanished showing nothing. Any file path containing a space
would split the same way.

Enable `escape_args` for diff panes, whose argv is built in code.
Config-shell args stay raw to match upstream alacritty's handling of
user-authored shell arguments.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mathix420 mathix420 merged commit e27e3a0 into master Jun 12, 2026
2 checks passed
@mathix420 mathix420 deleted the windows-fixes branch June 12, 2026 10:42
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.

1 participant