Fixed centered marker column on the indent grid (ListStyle.markerSlotWidth) - #131
Closed
dylandeheer wants to merge 6 commits into
Closed
Fixed centered marker column on the indent grid (ListStyle.markerSlotWidth)#131dylandeheer wants to merge 6 commits into
dylandeheer wants to merge 6 commits into
Conversation
The theme can recolor every element except heading text (it inherits bodyText), and the heading config covers every metric except the face — so an embedder that wants serif display headings over a sans body has to fork. HeadingStyle.fontName picks a PostScript face for headings, honored exactly so the chosen weight survives; an unresolvable name falls back to the stock bold base font, like TaskCheckboxStyle's symbol fallback. MarkdownEditorTheme.headingText colors heading text while the `#` glyphs stay on headingMarker and inline constructs inside a heading keep their own ink. Emphasis inside a heading still composes on top of the configured face (traits added, family and per-level size kept). Both knobs default to nil, which keeps styling identical to before. Co-authored-by: Cursor <cursoragent@cursor.com>
Historically the visual list indent is the raw source whitespace: every first line starts at a flat indentPerLevel, nesting shows only as the advance of the leading spaces/tabs (two spaces = ~8pt -- far off any design grid), and the marker-to-content gap is whatever '- ' happens to measure per marker kind. With markerTextGap set, markers land on a deterministic grid: a level-n item starts at n x indentPerLevel (level 1 on the body origin), the leading whitespace collapses (hidden-marker font; tabs advance by a sub-point interval), and content hangs a fixed slot after the marker for every marker kind via a kern on the final spacer char -- so bullet, any digit count, and task content all align, wrapped lines hang at the content edge, and the caret keeps working on real text advances. The drawn task checkbox left-aligns to the slot origin in grid mode. nil (the default) keeps the historical geometry exactly. Co-authored-by: Cursor <cursoragent@cursor.com>
ListStyle.orderedMarkerStyles formats each nesting depth's painted ordered marker (numeric / alpha / roman, cycling), so nested runs can render 1. / a. / i. while the source keeps its literal digits -- the same source-untouched contract display numbering already follows. A non-numeric depth keeps the overlay active even when the computed number matches the source, since '1.' still has to display as 'a.'; caret and selection reveal the raw digits exactly as before. The default (a single .numeric) keeps every level numeric. MarkdownEditorTheme.listMarker colors the painted bullet and ordered marker glyphs independently of bodyText; nil (the default) keeps the historical body ink. Co-authored-by: Cursor <cursoragent@cursor.com>
…n checkbox to its marker slot Two fixes to the opt-in indent grid observed in a real render: - Grid depth now comes from the item's position in the run's indent ladder (seeded across scoped-restyle windows like the ordered display numbers) instead of a fixed 2-columns-per-level divisor, so CommonMark ordered nesting (3+ columns per level, driven by the parent marker width) steps exactly one level per parent. Legacy (nil markerTextGap) geometry is untouched. - A hidden task in the grid now collapses its whole `- [ ] ` prefix so the box range's own position is the marker-slot origin, and the drawn square left-aligns there (previously the square was offset from the box chars, which sit AFTER the full-advance `- `, pushing it to negative x where the container clipped it). Co-authored-by: Cursor <cursoragent@cursor.com>
…er style The per-depth ordered marker style now reads the structural nesting depth (indent-ladder position) instead of a spaces/2 divisor, so CommonMark ordered nesting (3 columns per level) picks the next style exactly one level per parent — `1.` / `a.` / `i.` on levels 1/2/3. This branch now builds on feature/list-indent-grid, which introduces the shared depth computation. Co-authored-by: Cursor <cursoragent@cursor.com>
…indent grid Every marker kind occupies an invisible fixed-width column at its depth indent: painted bullets and ordered markers center horizontally in the column (the ordered overlay always paints in this mode so the source digits' left alignment can't leak), and the drawn task checkbox fills the column exactly — its square side becomes the slot width, shared by draw and hit-test. Content hangs markerSlotWidth + markerTextGap after the marker origin, so checkbox, bullet, and number items read as one alignment grid. nil (the default) keeps the gap-only grid geometry exactly. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
What
Adds
ListStyle.markerSlotWidth(opt-in, only in effect together withmarkerTextGap): every list marker occupies an invisible fixed-width column at its depth indent, so checkbox, bullet, and number items share one alignment grid.•and the painted ordered marker are CENTERED horizontally in the column. Ordered markers always paint in this mode (the source digits' natural left alignment can't leak); raw reveal on selection keeps the source position, as today.markerSlotWidth, shared by draw and hit-test throughTaskCheckboxGeometry.markerSlotWidth + markerTextGapafter the marker origin; nested levels step byindentPerLevelas before.nil(the default) keeps the gap-only grid geometry exactly; withoutmarkerTextGapthe knob is inert.Why
With a gap-only grid the three marker kinds have different visual widths, so a checkbox item, a bullet item, and a numbered item never read as one column. A fixed slot as wide as the checkbox puts every marker on the same grid.
Tests
ListMarkerSlotTests— gating, shared content edge for all three marker kinds, nested stepping, spacer kern, forced ordered overlay, checkbox slot fill. ExistingListIndentGridTestsunchanged and green; full suite green.Stacks on the indent grid (#123) and marker styling (#124); the last commit is this feature.
Made with Cursor