Summary
Follow-up from #547. GTK and TUI use two different coordinate conventions for the window_rects fed into Engine::calculate_group_window_rects / render::build_screen_layout, and every shared render helper that touches those rects (e.g. the new render::breadcrumb_draw_targets() from #547) has to carry an origin_offset parameter purely to paper over the difference. Unifying the convention would let that parameter — and the offset math at every call site — disappear.
The asymmetry
- GTK (
src/gtk/mod.rs::render_content): editor_bounds = WindowRect::new(x, y, w, editor_area_h) where (x, y) comes from layout.main_content_bounds (i.e. absolute screen/pixel coordinates). Window rects, and everything derived from them (e.g. BreadcrumbBar::bounds), are already in final screen space.
- TUI (
src/tui_main/render_impl.rs::build_screen_for_tui): content_bounds = WindowRect::new(0.0, 0.0, content_cols, content_rows) — always origin (0, 0), i.e. content-area-relative. Every draw call site (tab bars, breadcrumbs, dividers, windows) has to manually add editor_area.x / editor_area.y to translate back into terminal screen space.
This is presumably historical (TUI's content_bounds predates the shared render::build_screen_layout path), not a deliberate design choice — nothing in either backend's rendering model requires window rects to be in one convention over the other.
Proposed direction
Make TUI's window_rects (and therefore every WindowRect/bounds field derived from them — BreadcrumbBar::bounds, tab bar bounds, divider positions, etc.) absolute in terminal-screen space from the start, matching GTK. Candidates:
Why this wasn't done in #547
This touches window-rect computation and every click/hit-test path in both backends — a much bigger, more architecturally invasive change than a bugfix PR should carry. It's exactly the kind of cross-cutting normalization the Platform-Neutral milestone (#7) exists for, but needs its own dedicated pass with full regression coverage on both backends' mouse/click paths, not a drive-by.
Acceptance criteria
Parent context: Platform-Neutral milestone (#7), surfaced while working #547.
Summary
Follow-up from #547. GTK and TUI use two different coordinate conventions for the
window_rectsfed intoEngine::calculate_group_window_rects/render::build_screen_layout, and every shared render helper that touches those rects (e.g. the newrender::breadcrumb_draw_targets()from #547) has to carry anorigin_offsetparameter purely to paper over the difference. Unifying the convention would let that parameter — and the offset math at every call site — disappear.The asymmetry
src/gtk/mod.rs::render_content):editor_bounds = WindowRect::new(x, y, w, editor_area_h)where(x, y)comes fromlayout.main_content_bounds(i.e. absolute screen/pixel coordinates). Window rects, and everything derived from them (e.g.BreadcrumbBar::bounds), are already in final screen space.src/tui_main/render_impl.rs::build_screen_for_tui):content_bounds = WindowRect::new(0.0, 0.0, content_cols, content_rows)— always origin(0, 0), i.e. content-area-relative. Every draw call site (tab bars, breadcrumbs, dividers, windows) has to manually addeditor_area.x/editor_area.yto translate back into terminal screen space.This is presumably historical (TUI's
content_boundspredates the sharedrender::build_screen_layoutpath), not a deliberate design choice — nothing in either backend's rendering model requires window rects to be in one convention over the other.Proposed direction
Make TUI's
window_rects(and therefore everyWindowRect/boundsfield derived from them —BreadcrumbBar::bounds, tab bar bounds, divider positions, etc.) absolute in terminal-screen space from the start, matching GTK. Candidates:content_boundswith origin(editor_area.x, editor_area.y)instead of(0, 0)inbuild_screen_for_tui.editor_area.x/.yoffset additions this uncovers (breadcrumbs already went through this in GTK regressions from #515: editor breadcrumbs broken + explorer treeview icons don't use Nerd Fonts (converge on quadraui; fix quadraui gaps first) #547 — grep fororigin_offsetandeditor_area.x as f64inrender_impl.rsandmouse.rsfor the rest).tui_main/mouse.rs) doesn't double-apply an offset that's now baked into the rects it reads.Why this wasn't done in #547
This touches window-rect computation and every click/hit-test path in both backends — a much bigger, more architecturally invasive change than a bugfix PR should carry. It's exactly the kind of cross-cutting normalization the
Platform-Neutralmilestone (#7) exists for, but needs its own dedicated pass with full regression coverage on both backends' mouse/click paths, not a drive-by.Acceptance criteria
origin_offset-style parameters (e.g. onrender::breadcrumb_draw_targets()) can be dropped/hardcoded to(0.0, 0.0)for both backends.tui_main::mouseand friends) continue to pass, plus new coverage for the specific offset removal if any test previously encoded the old relative convention.Parent context:
Platform-Neutralmilestone (#7), surfaced while working #547.