#821: Adopt quadraui render_markdown_to_styled for hover popups — 0 uses today, ~350 lines of regex markdown - #848
Merged
JDonaghy merged 5 commits intoSep 5, 2026
Conversation
Hover popups (EditorHoverPopup / PanelHoverPopup) now style markdown via quadraui::compose::markdown::render_markdown_to_styled instead of vimcode's hand-rolled MdStyle-to-color span walk (render.rs's now-deleted hover_line_to_styled_text / markdown_rendered_to_quadraui_lines, ~120 lines). core::markdown.rs (pulldown-cmark) is untouched and still used by the editor-buffer inline highlighter and markdown-preview buffers — genuinely out of scope per the issue, and not functionally substitutable there (tree-sitter code highlighting + bare-URL scanning it does are reused here, not duplicated). EditorHoverPopup/PanelHoverPopup now store the raw markdown source plus a theme-independent structure (plain line_text, resolved links, tree-sitter code_highlights) computed once at show time via the new core::markdown::hover_markdown_structure. render.rs recomputes styled spans from that same source at paint time with the live theme, then overlays vimcode's own tree-sitter highlighting onto fenced code blocks (quadraui's renderer is deliberately language-agnostic; its own doc says as much). One real feature gap: quadraui only recognizes `[text](url)` links, not bare `http://`/`https://` autolinks. core::markdown::linkify_bare_urls is the compatibility shim that closes it locally (rewrites bare URLs into bracketed links before quadraui ever parses them) pending a proper upstream fix. Distinct per-level heading colors (Theme::md_heading1/2/3) are not preserved — quadraui renders every heading as bold + a larger line_scales factor, uniformly colored; accepted, documented divergence. New black-box tests, both backends (verified failing red with the linkify_bare_urls call removed, since quadraui's parser never turns unbracketed text into a link without it): - tui_main::shell_app::driver_editor_hover_renders_code_and_bare_url_link_via_quadraui_markdown - gtk::testing::editor_popups::editor_hover_popup_renders_code_and_bare_url_link_via_quadraui_markdown_on_gtk Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The #821 commit replaced EditorHoverPopup's `rendered: MarkdownRendered` field with the theme-independent `line_text: Vec<String>` (plus `links` / `code_highlights`), but tests/ext_panel.rs still read `hover.rendered.lines` in three places, so `cargo test` failed to compile with E0609 and the whole suite — including the new hover driver tests — never ran. Point the three assertions at `line_text`, which carries exactly the same markdown-stripped plain per-line text the old `rendered.lines` did, so the tests keep asserting the same thing (hover content contains the annotation / plugin text). Test-only fix; no behaviour change. `cargo build`, `cargo test --no-run`, `cargo fmt -- --check`, `cargo clippy -- -D warnings` and `cargo clippy --no-default-features -- -D warnings` are all clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The #753 driver test `group_divider_drag_moves_the_painted_divider_via_shell_app` was failing on `develop` (verified by running it on unmodified `origin/develop` in this worktree — the failure predates #821 and is unrelated to the hover-popup markdown adoption). Root cause: `RenderedWindow::rect` is an f64 *widening* of the f32 rect `quadraui::SplitTree::layout` produced, but the sibling divider's `position` is that layout's `bounds.x + first_w` added in **f32**. Dragging a group divider to column 48 of a 46-wide editor area stores `ratio = 14/46`, which f32 resolves to a left pane `13.999999046…` cells wide. quadraui's f32 `34.0 + 13.999999046` rounds back up to exactly `48.0` (the divider paints at cell 48), while vimcode's f64 sum stays `47.999999046…` and truncates to 47 — putting the left pane's own separator at column 46 instead of 47. `group_divider_cells`' #481 "the left pane already separates these two groups" guard then stopped matching and *both* lines painted, with a blank column wedged between them. Fix: one `window_right_edge_cell` helper that sums the edge in f32 and truncates with quadraui's own `SplitTreeDivider::cell_position` convention, used by both `vertical_separator_cells` and `group_divider_cells`' scrollbar check. Tests: the existing driver-tier test goes green; added `separator_column_tracks_the_divider_after_a_fractional_drag`, a pure-data pin on the exact post-drag geometry. Both were observed RED with the helper reverted to the f64 sum and green with it restored. Also fixes a clippy `--all-targets` warning introduced earlier on this branch (`line_text.get(0)` → `.first()`). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`make_sc_engine_with_files()` built its engine with `Engine::new()`, whose `cwd` is the process working directory — i.e. the vimcode checkout. The `sc_*` actions the tests around it drive shell out to real `git -C <engine.cwd>` commands, so `test_sc_unified_dispatch_stage_all` ran `git add -A` over the developer's working tree and `test_sc_commit_ctrl_enter_commits` then committed it, under the message "test\nmultiline". Observed for real: a plain `cargo test` during the #821 work silently swept every uncommitted change in this worktree into a junk commit. The tests' own comments ("will fail silently since we're not in a real git repo") were simply untrue when run from a checkout. Point the fixture's `cwd` at an empty, pid-suffixed, deliberately non-git scratch dir under the system temp dir, so those git calls fail the way the tests already assume, and add `sc_fixture_cwd_is_never_inside_a_git_work_tree` as a standing guard (it fails against the pre-fix fixture). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
linkify_bare_urls_in_line tracked the fenced-code-block toggle but not single-backtick inline code spans. A hover line like `See \`http://x\` for docs.` got rewritten to wrap the URL in markdown link syntax even though it sits inside an inline code span — and quadraui's parse_inline treats backtick-delimited text as verbatim, so the rendered code span showed the literal `[http://x](http://x)` text instead of the URL, un-clickable. Track a backtick toggle alongside the fenced-block toggle and skip scanning while inside one. Adds regression tests for the inline-code case, a URL immediately after a closed code span, and end-to-end hover_markdown_structure coverage confirming no link is produced. Also documents two further quadraui-vs-local-renderer parity gaps the issue asked to have called out (no image support, single-level list support only) that were verified but not yet written down.
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.
Closes #821
Automated PR opened by coordinator for review of issue #821.