Skip to content

fix(ghostty): preserve literal hashes in unquoted config values - #52756

Merged
nwparker merged 1 commit into
mainfrom
fix/ghostty-literal-hash
Nov 30, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/ghostty-literal-hash

Conversation

@nwparker

@nwparker nwparker commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #50540.

Ghostty config syntax only treats whole-line # prefixes as comments — inline # comments are not supported. parseGhosttyConfig previously stripped whitespace-prefixed # suffixes via stripInlineComment(), which truncated unquoted values such as theme file paths containing #.

What Changed

  • src/main/ghostty/parser.ts: removed stripInlineComment() while keeping whole-line # comment handling and quote stripping intact.
  • src/main/ghostty/parser.test.ts: added a parser regression test verifying literal # preservation in unquoted values alongside whole-line comments and hex colors.

Performance

None — removes a character-by-character scan per config line.

Verification

  • pnpm check:changed --base=origin/main: all 27 checks passed (including src/main/ghostty/parser.test.ts and palette-index-import.test.ts).
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​20 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​20
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1 $\color{#cf222e}{\Huge{\mathbf{−}}}$​20 $\color{#cf222e}{\Huge{\mathbf{−}}}$​19

@greptile-apps

greptile-apps Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Preserves literal hashes in unquoted Ghostty config values.

  • Ghostty config values keep hashes that appear inside them.

Reviews (1) · Last reviewed commit: "fix(ghostty): preserve literal hashes in..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

parseGhosttyConfig continues to skip whole-line comments and now preserves hash characters in configuration values, including hashes after whitespace. A new test covers indented comments and hash-containing values.

Severity of issue fixed: Low

Merge Risk: Minimal · up to b84ff

Ghostty config values that contain a literal hash, such as theme paths, are now preserved instead of truncated. No concrete merge risk remains.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Description check Inconclusive The description covers the main template sections. It has a Summary that explains the mechanism and links issue #50540, a What Changed section listing both files, a Performance answer, and a Verificat… Add the missing template sections: an ELI5 summary, a Why section explaining why removing inline-comment stripping beats the alternatives, and a Visual Proof entry (write N/A with a reason, since this is a parser change). Add a Risk secti…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the main change: unquoted Ghostty config values now keep literal # characters. The raw summary confirms parseGhosttyConfig stops stripping inline comments, and the fix is scoped to…
Linked Issues check Passed [#50540] requires that unquoted Ghostty values keep a literal # and that whole-line comments stay ignored. The diff removes stripInlineComment() from src/main/ghostty/parser.ts and the value i…
Out of Scope Changes check Passed All changes map to [#50540]. The parser change removes the inline-comment helper and its call. A comment line documents the new behavior. The added test covers the changed parsing behavior. No unrelat…
Full details: Title check

Explanation

The title names the main change: unquoted Ghostty config values now keep literal # characters. The raw summary confirms parseGhosttyConfig stops stripping inline comments, and the fix is scoped to the ghostty parser. The fix(ghostty): prefix follows a conventional format and is specific enough for a reviewer scanning history.

Full details: Linked Issues check

Explanation

[#50540] requires that unquoted Ghostty values keep a literal # and that whole-line comments stay ignored. The diff removes stripInlineComment() from src/main/ghostty/parser.ts and the value is no longer truncated at the whitespace-prefixed #. Whole-line comment handling and quote stripping remain. The new test in src/main/ghostty/parser.test.ts checks that theme = /tmp/themes/my # dark theme parses intact, that indented and unindented whole-line comments are ignored, and that font-size and a hex background still parse. Gap: the issue reproduction also runs the value through the existing real-file theme resolver and expects background/foreground colors. The PR test covers parser output only and does not exercise theme resolution. The core parser requirement is met. The resolver path is not covered by a test in this PR.

Full details: Out of Scope Changes check

Explanation

All changes map to [#50540]. The parser change removes the inline-comment helper and its call. A comment line documents the new behavior. The added test covers the changed parsing behavior. No unrelated files or behavior changes appear in the whole-PR diff against the merge base. Related issues #37353 and #7126 are context only and are not implemented here.

Full details: Description check

Explanation

The description covers the main template sections. It has a Summary that explains the mechanism and links issue #50540, a What Changed section listing both files, a Performance answer, and a Verification section. It omits the template's ELI5, Why (alternatives considered), Visual Proof (N/A with reason), and Risk sections, and it leaves the Testing checkboxes unchecked. It also does not state the risk level or a revert plan.

Resolution

Add the missing template sections: an ELI5 summary, a Why section explaining why removing inline-comment stripping beats the alternatives, and a Visual Proof entry (write N/A with a reason, since this is a parser change). Add a Risk section with a Level (for example Low) and a rollback plan (a plain revert). Check the Testing boxes that apply, and state which platforms were tested. The author reported Linux testing in the linked issue, so name that platform in the Testing section. Complete the Performance line with the full sentence, for example: None, because this only runs when a config file is parsed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ca4d9f4a-d3f8-49f7-ae13-ee9348c974e9
Commits

Reviewing files that changed from the base of the PR and between 9b27fdb and b84ff2e.

Files selected for processing: 2

  • src/main/ghostty/parser.test.ts
  • src/main/ghostty/parser.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@nwparker
nwparker merged commit 62cd76c into main Nov 30, 2026
55 checks passed
@nwparker
nwparker deleted the fix/ghostty-literal-hash branch November 30, 2026 00:00
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.

[Bug]: Ghostty theme paths containing a literal hash are truncated

1 participant