Skip to content

Release 0.1.0-alpha.24: editor preview integration (#5 #6 #7) and the browser https fix - #8

Merged
239573049 merged 6 commits into
mainfrom
release/0.1.0-alpha.24
Oct 21, 2026
Merged

239573049 merged 6 commits into
mainfrom
release/0.1.0-alpha.24

Conversation

@239573049

Copy link
Copy Markdown
Collaborator

Brings the release/0.1.0-alpha.24 branch back to main. 0.1.0-alpha.24 of the six TKCode.StreamMark.* packages was published from this branch (CI run 39552495464).

What it contains

Closes #5, closes #6, closes #7.

Notes for review

  • Verified on the exact release tree: dotnet test StreamMark.slnx (Core 196, Avalonia 371); the publish run's native build, build-test (linux / macOS / windows) and NativeAOT smoke jobs all passed, 0 IL warnings.
  • tools/cpu-bench.sh was run once but is not a valid measurement: the machine was heavily loaded (idle scenario 7.5% instead of 0.0%). The streaming hot path only gained O(1) work, but the benchmark should be re-run on a quiet machine and compared with docs/benchmarks.md.
  • Known limits: MarkdownView only (not TranscriptView); find highlights are not recomputed after RefreshMarkdown; precision is block-level.

🤖 Generated with Claude Code

239573049 and others added 6 commits October 20, 2026 19:42
SocketsHttpHandler does not exist in the browser: setting UseCookies or
AllowAutoRedirect throws PlatformNotSupportedException, so a MarkdownServices
created in a WebAssembly app failed in its static initializer. The browser now
uses HttpClientHandler; the fetch API follows redirects itself, so the per-hop
policy check applies on desktop only. Desktop behavior is unchanged.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
…chors

MarkdownView gets block-level mapping between Markdown source offsets and
rendered positions, so an editor preview can sync its caret and scroll:

- ScrollToSourceOffset(offset) scrolls to the deepest block containing the
  offset (list items and paragraphs inside quotes included). The result says
  why nothing moved: NoDocument, OutOfRange or LayoutPending.
- GetSourceRange(TextPoint) and GetSelectionSourceRange() map a rendered
  point or the selection back to the source range of the blocks it covers.
  TextPoint.Offset is an offset in the segment's plain text, never a source
  offset, so emphasis and links cannot be mistaken for source columns.
- CaptureAnchor() / RestoreAnchor() save the character at the top of the
  outer ScrollViewer plus its pixel displacement, so width, font or theme
  changes keep the reading position. Anchors are tied to the new
  MarkdownView.DocumentId (not the snapshot Generation, which also changes on
  Complete()), so an anchor never restores onto a different document.
- SourceText.ToLocation / ToOffset define the line/column convention: UTF-16
  code units, CRLF counts as 2 and is not normalised.

Closes #6

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e source

Task checkboxes stay read-only by default. With
MarkdownView.IsTaskInteractionEnabled, a click on the box (or Space/Enter once
it has focus) raises TaskToggleRequested instead of changing anything:
StreamMark never edits the source or the snapshot, the host decides, edits its
own text and assigns it back. A rejected request leaves the screen unchanged.

- ListItemBlock.TaskMarker holds the source range of "[ ]" / "[x]", taken from
  Markdig's TaskList span. It enters ComputeFingerprint as a position relative
  to the list item, so a list that merely shifts does not produce an Update.
- TaskToggleRequestedEventArgs carries the marker range, current and requested
  state, DocumentId and snapshot Version; ApplyTo(source) replaces only the
  character inside the brackets, so indentation and CRLF are preserved.
  MarkdownView.IsCurrent(request) lets the host reject a stale request.
- Requests are only raised for a complete snapshot, not while streaming.
- Clicking the task text still selects text. Task items expose a CheckBox
  automation peer with IToggleProvider.

Closes #7

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ross a full-text replace

MarkdownView.RefreshMarkdown(text) replaces the whole text without clearing the
view. Assigning Markdown still means "a new document" and resets everything;
StreamingDocument stays append-only.

- The old content stays on screen until the new text is parsed. The view
  remembers StreamingDocument.Version at refresh time and does not apply a
  snapshot that has not caught up, so rapid A -> B -> C updates never show A or
  B once C is accepted.
- SnapshotEdit aligns the old and new snapshots by content: common prefix and
  suffix, then a longest-common-subsequence match of what lies between (falls
  back to positional pairing above 1M block pairs). Blocks that only moved
  because text was added or removed before them become Update ops, so their
  views, layout and block state survive. No new DiffKind, so the three
  switches stay as they are. SnapshotDiff alone would treat every block after
  an insertion as removed and re-inserted.
- BlockStateStore.Remap, SelectionRemap and the reading anchor follow the
  alignment. A selection endpoint inside a rewritten block is clamped to the
  paired new block; inside a deleted block it moves to the start of the next
  surviving block (or the document end), and a selection whose ends land on
  the same point is cleared.
- StreamingDocument.Load is now atomic (clear, write and mark complete under
  one lock) so the worker can no longer pick up an incomplete intermediate
  snapshot between Reset and Complete. StreamingDocument.Version is exposed.
- The Gallery NativeAOT smoke test checks the new alignment, task marker and
  line/column paths (0 IL warnings, all checks pass).
- Notes the timing-sensitive LongCodeTests assertion as a known local flake.

Closes #5

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds source-offset navigation and reading anchors (#6), opt-in task checkbox interaction (#7) and RefreshMarkdown for editor previews (#5) on top of alpha.23, keeping the browser https fetch fix (2bb0412) that is not on main.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
nuget — 2e9d78c5 Deployed Oct 21, 2026 by 239573049 via nuget #39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment