Skip to content

#550: Unify GTK (absolute) vs TUI (content-relative) window-rect coordinate conventions - #583

Merged
JDonaghy merged 1 commit into
developfrom
issue-550-unify-gtk-absolute-vs-tui-content-relati
Jul 16, 2026
Merged

#550: Unify GTK (absolute) vs TUI (content-relative) window-rect coordinate conventions#583
JDonaghy merged 1 commit into
developfrom
issue-550-unify-gtk-absolute-vs-tui-content-relati

Conversation

@JDonaghy

Copy link
Copy Markdown
Owner

Closes #550

Automated merge from the coordinator for assignment 5b412dfb58f9 on issue #550.

Worker branch: issue-550-unify-gtk-absolute-vs-tui-content-relatidevelop.

TUI computed window_rects (and everything derived from them —
breadcrumb/tab-bar bounds, dividers, window rects) relative to the
editor content area's own top-left, then re-added editor_left/menu_rows
at ~40 draw and click-hit-test call sites in render_impl.rs and
mouse.rs. GTK's window rects were already absolute. This asymmetry is
why render::breadcrumb_draw_targets()/tab_bar_draw_targets() carried an
origin_offset param that only TUI needed.

- build_screen_for_tui now builds content_bounds at the editor area's
  real absolute origin (activity bar + sidebar, menu bar), matching
  GTK's convention, instead of always (0.0, 0.0).
- Dropped the now-always-(0,0) origin_offset param from
  breadcrumb_draw_targets()/tab_bar_draw_targets(); updated both
  backends' call sites.
- Removed every now-redundant editor_area.x/.y (render_impl.rs) and
  editor_left/menu_rows (mouse.rs) offset addition applied to
  window-rect-derived data — window/tab-bar/breadcrumb/divider bounds,
  click and hover hit-tests, scrollbar tracks, tab-drag geometry.
  screen_to_drop_group_bounds's TUI call sites pick a (0,0) vs. real
  origin drop_origin exactly like GTK's existing #515 fix, so split-mode
  tab-group-drop overlays don't double-count the origin.
- quadraui's TUI-only draw_find_replace(..., editor_left) still expects
  a content-relative group_bounds internally (can't edit the quadraui
  repo from here); vimcode's wrapper now always passes 0 since
  group_bounds is absolute already, keeping that internal translation a
  no-op. mouse.rs's matching hit-test math updated identically.
- Added two regression tests in tui_main::mouse::tests that build a real
  ScreenLayout via build_screen_for_tui with sidebar + menu bar visible
  (non-zero origin) and dispatch clicks at the painted absolute
  coordinates, verified to fail if the offset math regresses.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unify GTK (absolute) vs TUI (content-relative) window-rect coordinate conventions

1 participant