Repository navigation
fix(workbench): keep active and incomplete Markdown syntax visible - #7117
Merged
Merged
Conversation
Use closed-range selection intersection when deciding whether to conceal Markdown syntax in the composer and file editor, so markers stay visible while typing at a node's end or selecting across it. Also skip concealing empty blockquote markers and unclosed or empty fenced code blocks so unfinished '>' and '```' input never disappears. Generated-by: Antigravity (Gemini)
…rams on complete fences Limit fenced code block detection to CommonMark's 0..=3 leading spaces so 4-space indented code lines are never mistaken for fences, check non-empty content via the parsed `Code.value`, and require the same complete-fence check before registering Mermaid diagrams in file preview. Generated-by: Antigravity (Gemini)
… select-all Keep syntax reveal keyed to `selection().head()` with closed bounds (`owner.start <= pos && pos <= owner.end`) instead of intersecting the full selection range. Expanding every formatted span covered by `AllSelection` shifts horizontal layout during Cmd+A, breaking click hit-testing and caret geometry in desktop composer tests. Generated-by: Antigravity (Gemini)
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
Typing
>or ``` in the composer (and Markdown file editor) immediately hid the typed characters because:Presentation::decorationschecked!owner.contains(&pos)againstselection().head(). That half-open range excludedowner.end, which is where the caret sits right after typing.code_block()concealed the opening fence line even for unclosed or empty fenced code blocks (hidingand language info strings likerust while typing or after moving focus away), treated 4-space indented literal fence lines as closing/opening fences, andReader::visitregistered incomplete or empty Mermaid blocks for diagram replacement before validating the fence.quote()also concealed>on empty blockquote lines (turning>,>, or>>>blank).This keeps
#6951's existing preview design intact while fixing both causes:selection().head()(owner.start <= pos && pos <= owner.end), keeping active syntax visible at trailing carets without expanding the whole document onCmd+A, and removing the+ 1end-bound workaround inlist_marker.Code.valuehas non-empty content.>prefixes on lines that have non-empty content after the quote markers.Refs #6951
Verification
cargo nextest run -p maka-workbench -E 'test(composer_input::markdown)'— 4 passed (covering trailing-caret reveal,AllSelectionnon-expansion, empty quotes, unclosed/empty/4-space-indented fences, 3-space valid fences, and Mermaid diagram gating).rustfmt --edition 2024 --check products/maka/workbench/src/composer_input/markdown.rs— passed.cargo clippy -p maka-workbench --all-targets --no-deps -- -D warnings— 0 warnings on the changed lines (pre-existingcollapsible_if/items_after_test_modulewarnings on untouched lines inquick_tools.rsandmarkdown.rs:392).native-macos/native-windows) for the desktop composer suite.AI use
Select exactly one:
Tool(s) and scope: Antigravity (Gemini) diagnosed the root cause, implemented the fix and regression tests in
products/maka/workbench/src/composer_input/markdown.rs, and ran local verification; GPT-6.2-Sol (High) performed an adversarial review that surfaced the 4-space fence and Mermaid gating edge cases.Checklist
Does this PR entail a change in behavior?