Repository navigation
mixin_markdown_widget: fix streaming block identity, highlight flicker, and selection details - #543
Merged
Merged
Conversation
boyan01
added this pull request to stack #545
October 20, 2026 12:01
…r, and selection details - Keep the id of a streamed tail block (and its nested blocks) stable across appendChunk, so its state, code block scroll position, and caches survive each chunk. Full parses and setData keep content-hashed ids. - While a streamed code block grows, show its last highlight with the new tail in plain text instead of flashing back to plain, and run at most one highlight per block at a time instead of one per chunk. - Keep one tap recognizer per link while the link stays in the document, so cached rows never hold a disposed recognizer. - Call onTapLink through a stable forwarder, so passing a new closure on every parent rebuild no longer clears the row cache. - Double-click selects words in CJK text: CJK punctuation separates words and non-ASCII runs narrow to ICU word boundaries. ASCII text keeps its rule. - Type the block state access of the document view instead of using dynamic. - Add MarkdownController.updateData, which appends when the new text extends the current data and parses in full otherwise. Deprecate the misspelled MarkownWidget alias and MarkdownDocumentParser.parseAppending, which ignores its previous document.
boyan01
force-pushed
the
mixin_markdown_widget/step0-fixes
branch
from
October 20, 2026 13:29
11ae229 to
4805c51
Compare
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.
Summary
Small fixes found while reviewing
mixin_markdown_widget. No architecture change. This is the base of a stack; the selection refactor builds on top.Also:
currentState as dynamicin the document view → internalMarkdownSelectableBlockHandleinterface.MarkdownController.updateData(data, {streaming}): appends whendataextends the current data, else full parse; commits unlessstreaming.@Deprecated:MarkownWidgetalias,MarkdownDocumentParser.parseAppending(ignorespreviousDocument).Evidence
markdown_link_recognizer_test.dartfails against the oldlib/: the cached- [link](url)row holds a recognizer that was already disposed.After: ids stay the same across appends (paragraph, fenced code, list and its item children); the recognizer test passes.
flutter analyze: no issues.flutter test: 214 passed (192 existing, unchanged expectations + 22 new inmarkdown_controller_streaming_test,markdown_code_highlight_cache_test,markdown_link_recognizer_test,markdown_word_selection_test).benchmark/incremental_append_benchmark.dart: baseline 112 ms → 107 ms, large-prefix 60 ms → 63 ms (noise).flutter_testerICU has no CJK dictionary, so tests assert dictionary-independent properties).Merge Danger
Door: two-way
Internal changes plus one additive API and two deprecations; reverting is a plain revert.
Blast Radius: streaming
Apps that stream markdown see the tail block keep its state instead of remounting. Highlight placeholders may briefly show a stale last token (e.g. an unclosed string) until the real highlight lands.
codeBlockBuilder/bulletBuilderchanges still do not invalidate cached rows (pre-existing).