macOS: config parser silently ignores keybinds after a documentation comment #13441
Issue DescriptionGhostty's config reader can silently stop reading a file when an ignored blank or comment line ends exactly at the end of its current reader buffer, even when the file has more content. This is a parser EOF bug, not a keybind-specific issue.
This affected Cmd+D only incidentally: a later Expected BehaviorGhostty should continue reading after a comment or blank line at a reader-buffer boundary. All following configuration entries should be applied, and Actual BehaviorWith the broken configuration below, keybind = cmd+d=paste_from_clipboard
keybind = super+d=new_split:rightChanging only the comment-line length by one byte makes the same keybind apply: keybind = super+d=paste_from_clipboardReproduction Steps
Ghostty LogsNo log or validation diagnostic is emitted. In both variants, Ghostty VersionOS Version InformationmacOS 27.0 on Apple Silicon. (Linux only) Display ServerN/A (Linux only) Desktop Environment/Window ManagerN/A Minimal Ghostty ConfigurationBroken variant: # followed by exactly 2046 ASCII `x` bytes, then a newline (2,048 bytes total for this line)
keybind = cmd+d=paste_from_clipboardControl variant: change the count to 2,045 Additional Relevant ConfigurationNone. The reproduction uses a fresh temporary I acknowledge that:
|
Replies: 2 comments 2 replies
|
Here's my full config file for reproduction. Correction: I found the actual root cause, and my earlier “68-byte comment makes later keybinds ignored” diagnosis was backwards. This is a Ghostty
var entry = while (self.r.seek != self.r.end) {
...
_ = self.r.streamDelimiterEnding(&writer, '\n') ...;
_ = self.r.discardDelimiterInclusive('\n') catch {};
...
if (entry.len == 0 or entry[0] == '#') continue;
break entry;
} else return null;If a blank/comment line’s newline is the final byte of the current reader buffer, In my config, removing the four Markdown backticks from line 280 shifted the divider comment at line 457 so its newline landed at zero-based byte 16,384 (a 2 KiB buffer boundary). Ghostty then stopped parsing at line 457. That accidentally made Cmd+D paste only because it never reached the later active line: keybind = super+d=new_split:rightat line 531, which otherwise overwrites the intended earlier binding: keybind = cmd+d=paste_from_clipboardRestoring the original comment moves the divider newline to byte 16,388; parsing continues and the later The fix belongs in On a personal note, this is a crazy issue, it took my agent 6 hours of work to debug this, decompiling the code, checking sources, automating macos computer use and recreating this setup with a fresh install over 50+ attempts. |
Fixed: #13638