Add editor column guide controls#422
Open
yusufm wants to merge 1 commit into
Open
Conversation
schuyler
requested changes
Jun 23, 2026
schuyler
left a comment
Owner
There was a problem hiding this comment.
Thanks for the PR, @yusufm!
The shape here is solid — prefs, a guide drawn in drawViewBackgroundInRect:, optional hard-wrap, and a View › Column Guide submenu. The wrap path is where most of the risk is.
Issues
- Monospace assumption. Both the guide position (
columnGuideXPosition) and the wrap width derive from the advance width of"0"× columns. That only aligns for a fixed-pitch font; MacDown lets users pick any editor font, so with a proportional font the guide line and wrap point drift from the real character column. - Guide line vs. wrap point diverge.
columnGuideXPositionincludestextContainerOrigin.x(the inset), but the wrap container width inapplyColumnGuidePreferencesischarWidth*column + 2*paddingwith no inset term, so when wrapping is on the drawn line and the actual wrap boundary won't coincide. - Interaction with existing width-limiting.
applyColumnGuidePreferenceshard-setswidthTracksTextViewandcontainerSizein both branches. MacDown already manages editor width viaeditorWidthLimited/editorMaximumWidth+adjustEditorInsets; forcing the container to{CGFLOAT_MAX, CGFLOAT_MAX}when wrap is off can stomp that. Worth confirming width-limited + wrap-at-guide compose. - Horizontal scrolling/clipping. With
widthTracksTextView = NOand a fixed container wider than the viewport, the text view/scroll view needs to be horizontally resizable or text will clip. Is that configured?
Suggestions
- The new menu titles (Show Column Guide, Wrap at Column Guide, 80/100/120 Columns) aren't in
Localizable.strings. - Test gap: the tests cover
columnGuideXPositionand the clamp, but not the wrap-mode container sizing — the riskiest part is currently unexercised. applyColumnGuidePreferencesruns twice within onesetupEditor:pass (inset branch + end of setup); collapsing to once would avoid the double work.- Only 80/100/120 are reachable from the menu, but
editorColumnGuideWidthaccepts any integer — consider whether to constrain it.
Generated by Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tests