Skip to content

TUI: Migrate sidebar-item hover popup to a shared tooltip builder #478

Description

@JDonaghy

Tier: Small gap (needs panel-anchored tooltip variant in render.rs, or a generalized anchor on the existing builder)

Summary

render_panel_hover_popup() in src/tui_main/panels.rs:1526–1727 (~200 lines, 35+ `set_cell` calls) draws the sidebar-item hover popup by hand — box-drawing border, per-line markdown-style dispatch (`MdStyle` enum), byte-to-character mapping for style spans, and link hit-rect computation. The shared hover_popup_to_quadraui_tooltip() builder in render.rs:953 already does the same job for editor-anchored popups (which render_impl.rs:519 correctly delegates through). The sidebar-item variant is the only remaining hand-rolled popup path.

What exists

  • render::hover_popup_to_quadraui_tooltip(hover, x, y, viewport) -> (Tooltip, TooltipLayout) — builds quadraui Tooltip with positioning.
  • quadraui::tui::draw_tooltip() — TUI rasteriser, already wired (tui_main/quadraui_tui.rs:86).
  • render_editor_hover_popup() (panels.rs:1736) — already uses editor_hover_to_quadraui_rich_text() + draw_rich_text_popup() (confirmed converged; no duplication there).
  • Editor hover popup in render_impl.rs:519 already calls the shared tooltip builder.

What to do

  1. Decide on the anchor model. The sidebar hover positions the popup to the right of the sidebar at the hovered item's row; the editor hover positions it near the cursor. Either:
    • Option A: Generalize hover_popup_to_quadraui_tooltip() to accept an anchor strategy (right-of-rect, above-cursor, etc.), or
    • Option B: Add a sibling panel_hover_to_quadraui_tooltip(hover, sidebar_right_x, item_y, viewport) in render.rs that produces the same (Tooltip, TooltipLayout) shape.
  2. Replace render_panel_hover_popup() body with: build via the shared fn, draw via quadraui::tui::draw_tooltip(), extract link_hit_regions from the returned layout.
  3. Delete the manual border drawing, per-line MdStyle matching, and byte-to-character mapping in panels.rs:1589–1706.

Files

  • src/render.rs — small addition (~30 lines for an anchor-variant builder or anchor-strategy enum).
  • src/tui_main/panels.rs — replace render_panel_hover_popup() body (~200 lines → ~30 lines of wiring).

Dependencies

Minor render.rs change to expose a panel-anchor positioning variant. No quadraui-side work needed (Tooltip primitive already supports the data shape).

Notes

Part of the TUI convergence backlog (#474). The editor hover popup at panels.rs:1736 is already converged — only the sidebar-item path is hand-rolled. Don't touch the editor path.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    coordTracked by coord-tui pipelineenhancementNew feature or requestuiUI/rendering

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions