Skip to content

Fix live preview inline caret boundary#101

Merged
jsgrrchg merged 1 commit into
mainfrom
fix/live-preview-inline-caret-boundary
May 17, 2026
Merged

Fix live preview inline caret boundary#101
jsgrrchg merged 1 commit into
mainfrom
fix/live-preview-inline-caret-boundary

Conversation

@jsgrrchg
Copy link
Copy Markdown
Owner

Summary

Fixes a live preview caret visibility issue when the caret sits at the closing boundary of inline Markdown formatting, such as *italic text.*|.

Root Cause

Inline formatting reveal logic treated active ranges as half-open. A caret exactly at the end of an emphasis token did not activate the token, so the closing delimiter remained hidden as a zero-width inline decoration. That could make the caret appear hidden at the end of formatted text.

Changes

  • Add boundary-aware range detection for selection activity.
  • Use the boundary-aware strategy for inline formatting decorations.
  • Keep existing half-open behavior for links, highlights, and other token types.
  • Add a regression test for emphasis delimiters at the closing caret boundary.

Validation

  • npm test -- --run src/features/editor/extensions/livePreviewBlocks.test.ts src/features/editor/extensions/livePreviewInline.test.ts
  • git diff --check

@jsgrrchg jsgrrchg marked this pull request as ready for review May 17, 2026 12:05
@jsgrrchg jsgrrchg merged commit a4e96d4 into main May 17, 2026
3 checks passed
@jsgrrchg jsgrrchg deleted the fix/live-preview-inline-caret-boundary branch May 17, 2026 12:50
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.

1 participant