Skip to content

Migrate 7 Tooltip construction sites to quadraui's new builder API (quadraui#541 follow-up) #661

Description

@JDonaghy

What

Migrate all 7 quadraui::Tooltip { .. } exhaustive struct-literal construction
sites to the new Tooltip::new(id, text).with_*(..) builder API shipped by
JDonaghy/quadraui#541 (PR JDonaghy/quadraui#608).

Why

quadraui#541 gives Tooltip two new fields (border: TooltipBorder,
title: Option<String>) so a consumer can choose full-box / sides-only / no
border, and adds a title slot. Tooltip stays a plain exhaustive struct (not
#[non_exhaustive]) — see the Downstream impact doc comment on
quadraui::primitives::tooltip — so every exhaustive Tooltip { .. } literal
with no ..Default::default() fails to compile the instant the new fields
land, and this repo has 7 of them:

  • src/tui_main/panels.rs:810
  • src/render.rs:1151
  • src/render.rs:1490
  • src/render.rs:4285
  • src/gtk/draw.rs:1378
  • src/gtk/draw.rs:1667
  • src/gtk/draw.rs:1765

quadraui shipped Tooltip::new(id, text) (all other fields at their
behaviour-preserving default) plus .with_styled_lines(), .with_placement(),
.with_border(), .with_title(), .with_bg(), .with_fg() builder methods
specifically so call sites survive the next field addition too — this
migration is a one-time cost, not a recurring one, once done.

Tooltip::new's default border is TooltipBorder::Full, which is defined to
match what every backend already renders on develop today (GTK/macOS have
always stroked a full box; TUI has since #542 whenever height >= 3). So this
migration needs no new .with_border(..) calls to preserve current
on-screen appearance — it's a pure literal→builder rewrite.

Example

Before (src/render.rs:1151):

let tooltip = quadraui::Tooltip {
    id: quadraui::WidgetId::new("lsp_hover"),
    text: hover.text.clone(),
    styled_lines: None,
    placement: quadraui::TooltipPlacement::Top,
    bg: None,
    fg: None,
};

After:

let tooltip = quadraui::Tooltip::new(quadraui::WidgetId::new("lsp_hover"), hover.text.clone())
    .with_placement(quadraui::TooltipPlacement::Top);

Only chain .with_*() for fields that were set to a non-default value; drop
fields that matched the default (styled_lines: None, bg: None, fg: None,
placement: TooltipPlacement::default()).

Acceptance

  • All 7 sites use Tooltip::new(..).with_*(..) instead of a raw struct literal.
  • No visual change — this is a construction-syntax migration only.
  • cargo build && cargo test green once built against quadraui#541's
    branch (cargo update -p quadraui / the repo's local-path override —
    see this repo's own quadraui-pin docs — to build against the unmerged
    branch before it's on develop).

Blocked on

JDonaghy/quadraui#541 / PR JDonaghy/quadraui#608 landing on quadraui's
develop (the new Tooltip::new/with_* API doesn't exist before that).
Can be branched and written ahead of time against the PR branch; final merge
should wait for quadraui#541 to land so CI actually resolves the new API from
develop.

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

    blockedBlocked on a prereq (linked in body)coordTracked by coord-tui pipelineuiUI/rendering

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions