Skip to content

feat: support per-block separator theme overrides - #2299

Draft
cfsmp3 wants to merge 1 commit into
greshake:masterfrom
cfsmp3:fix_per_block_separators
Draft

feat: support per-block separator theme overrides#2299
cfsmp3 wants to merge 1 commit into
greshake:masterfrom
cfsmp3:fix_per_block_separators

Conversation

@cfsmp3

@cfsmp3 cfsmp3 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Problem

Separator settings (separator, separator_fg, separator_bg, start_separator, end_separator) in a block's [block.theme_overrides] were silently ignored: separators are rendered between blocks in print_blocks(), which only had access to the global theme. This was left as a TODO in #947 and reported in #2200, where it was noted there's no reason not to add it now.

Design

The one real decision here is which block's theme a separator between two blocks belongs to. This PR: a separator takes its settings from the theme of the block it precedes, and end_separator takes them from the last block's theme. Rationale: the separator's auto-FG already comes from the background of the block it precedes, so that block was always the separator's "owner" visually. Documented in doc/themes.md.

Implementation

  • RenderedBlock now carries the block's override-applied Arc<Theme> (captured at spawn, cheap clone).
  • print_blocks() split: the rendering logic moved to render_blocks() which returns the segments instead of printing, making it unit-testable; separator decisions now read the per-block theme.
  • Blocks without theme_overrides carry the global theme, so rendering is byte-for-byte identical when the feature is unused (covered by a test).

Tests

  • separator glyph and separator_fg taken from the preceding block's overrides
  • per-block start_separator / end_separator
  • no-overrides baseline (native separators, no injected segments)

Fixes #2200

@cfsmp3
cfsmp3 force-pushed the fix_per_block_separators branch from f5a9842 to c6ecf6f Compare August 1, 2026 07:51
Separator settings (separator, separator_fg, separator_bg,
start_separator, end_separator) in a block's theme_overrides were
silently ignored: separators are rendered across blocks in
print_blocks(), which only had access to the global theme (left as a
TODO in greshake#947).

Carry each block's overridden theme in its RenderedBlock, and take
each separator's settings from the theme of the block it precedes
(end_separator: from the last block's theme). Blocks without overrides
carry the global theme, so nothing changes when the feature is unused.

The separator rendering is extracted into render_blocks(), which
returns the segments instead of printing them, so it is now covered by
unit tests.

Fixes greshake#2200
@cfsmp3
cfsmp3 force-pushed the fix_per_block_separators branch 2 times, most recently from abf45b5 to 6e5d0bf Compare August 3, 2026 16:40
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.

Per-block separator tweaking not working

1 participant