mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-14 03:25:50 +00:00
# What CommaSplitter treats backslash as an escape character, which breaks Windows paths like C:\Users\foo since \U is not a valid escape. On Windows, treat backslash as a literal character outside of quoted strings. Inside quotes, escape sequences still work as before. Also fix Theme.parseCLI to not mistake the colon in a Windows drive letter (C:\...) for a light/dark theme pair separator. # How The platform behavior is controlled by a single comptime constant at the top of CommaSplitter: const escape_outside_quotes = builtin.os.tag != .windows; The next() function checks this constant to decide whether backslash triggers escape parsing outside quoted strings. All behavior lives in one place. For Theme, skip colon detection at index 1 on Windows so drive letters are not mistaken for pair separators. Escape-specific tests are skipped on Windows with SkipZigTest. Windows-specific tests are added separately to cover paths, literal backslash, and escapes-still-work-inside-quotes. # Note There are other places in config parsing that use colon as a delimiter without accounting for Windows drive letters (command.zig prefix parsing, keybind parsing). Those are separate from this PR. # Verified - zig build test-lib-vt passes on Windows (exit 0) - No impact on Linux/macOS (the constant is true there, all existing behavior unchanged) # What I Learnt - Platform behavior should live in a single constant or struct, not scattered across if-else branches in every test. The escape_outside_quotes constant mirrors the pattern upstream uses with PageAlloc = switch(builtin.os.tag) but for a simpler boolean case. - Use error.SkipZigTest for tests that cannot run on a platform, never silent returns. This way the test runner reports them as skipped, not silently passed. - When fixing a pattern (colon as delimiter), grep the whole codebase for similar issues even if you are not fixing them all in one PR. Note them for future work.