Skip to content

Fixed centered marker column on the indent grid (ListStyle.markerSlotWidth) - #131

Closed
dylandeheer wants to merge 6 commits into
nodes-app:mainfrom
GetWeeve:feature/list-marker-slot
Closed

Fixed centered marker column on the indent grid (ListStyle.markerSlotWidth)#131
dylandeheer wants to merge 6 commits into
nodes-app:mainfrom
GetWeeve:feature/list-marker-slot

Conversation

@dylandeheer

Copy link
Copy Markdown

What

Adds ListStyle.markerSlotWidth (opt-in, only in effect together with markerTextGap): every list marker occupies an invisible fixed-width column at its depth indent, so checkbox, bullet, and number items share one alignment grid.

  • The painted bullet 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.
  • The drawn task checkbox fills the column exactly — its square side becomes markerSlotWidth, shared by draw and hit-test through TaskCheckboxGeometry.
  • Item content hangs markerSlotWidth + markerTextGap after the marker origin; nested levels step by indentPerLevel as before.
  • nil (the default) keeps the gap-only grid geometry exactly; without markerTextGap the 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. Existing ListIndentGridTests unchanged and green; full suite green.

Stacks on the indent grid (#123) and marker styling (#124); the last commit is this feature.

Made with Cursor

dylandeheer and others added 6 commits August 3, 2026 22:59
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>
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.

2 participants