Skip to content

Phase B.5c — TUI + GTK trait coverage to 100% (master) #259

Description

@JDonaghy

Goal

Both TUI and GTK at 100% on quadraui::Backend. After B.5c, every primitive that has runtime usage either has a trait method that's used end-to-end, OR has a documented reason for not (e.g. backend-specific UX that genuinely doesn't fit the cross-backend contract). The runner crates (B.5e) depend on this being clean.

Context

B.5b shipped the GTK runtime migration (closed at #249 after 13 stages on develop), but uncovered concrete trait-coverage gaps that aren't bugs — they're architectural:

  1. Trait methods that return () but call sites need hit-region info. Backend::draw_status_bar returns (); call sites in both backends use Vec<StatusBarHitRegion> from the legacy direct shims. Same for draw_tab_bar (returns TabBarHits). Fix: redesign return types — either return the data, or split into draw + query.

  2. GTK trait impls that are forward-compat stubs because the rasteriser takes legacy render::Theme. Backend::draw_activity_bar and draw_terminal on GTK currently unimplemented!() because the existing rasterisers in crate::gtk::quadraui_gtk::* take render::Theme instead of quadraui::Theme. Fix: lift those rasterisers into quadraui::gtk::* (see Lift TUI + GTK rasterisers out of vimcode and into the quadraui crate #223).

  3. TUI bypasses the trait for half the draws. TUI's draw_frame calls quadraui::tui::draw_* directly. After the return-type redesign in (1), route TUI through the trait method so future generic paint::<B> consumers exercise the same code path GTK does.

  4. Primitives that don't have a trait method at all. Tooltip, dialog, context_menu, rich_text_popup, completions, find_replace — all 6 have rasterisers in quadraui::*::* but no Backend::* method. Both backends call the rasterisers directly. Fix: extend the trait per-primitive (some need return types for hit info: dialog needs button rects, rich_text_popup needs link rects).

Suggested stage order

Stage Goal
B5c.1 Redesign Backend::draw_status_bar to return Vec<StatusBarHitRegion>. Update both backend impls. Migrate all GTK + TUI call sites onto the trait. Validates the return-type pattern before applying to others.
B5c.2 Same shape for draw_tab_bar (returns TabBarHits).
B5c.3 Same shape for draw_text_display (no hit data — straightforward).
B5c.4 TUI draw_tree + draw_form migration onto trait method (no trait change; mechanical mirror of GTK B5b.8).
B5c.5 Lift quadraui_gtk::draw_activity_bar + draw_terminal_cells into quadraui::gtk::* with quadraui::Theme. Wire GTK trait impls to call them.
B5c.6 Trait extension + impls for the 6 currently-trait-less primitives. Group by complexity: text_display already done (B5c.3 reuses); dialog and rich_text_popup need return types; the rest are straightforward.
B5c.7 Final parity sweep + smoke tests on both backends.

Pickup files

  • quadraui/src/backend.rs — trait definition.
  • quadraui/src/gtk/, quadraui/src/tui/ — rasterisers.
  • src/gtk/quadraui_gtk.rs — in-tree shims to lift.
  • src/gtk/draw.rs, src/gtk/mod.rs, src/tui_main/render_impl.rs — call sites to migrate.

Why first

The runner-crate work (B.5e) needs every primitive to have a stable cross-backend trait surface. Doing the runner crates first would force the runner API to expose backend-specific hatches, defeating the boilerplate-elimination goal.

PLAN.md "🎯 NEXT FOCUS" section has the full context.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions