Problem
The same editor layout arithmetic (subtract tab bar, quickfix, terminal, debug toolbar, status bar from available space) is computed in multiple places:
- GTK
draw.rs:122-202 (~80 lines) — draw_editor
- GTK
mod.rs sync_scrollbar + sync_scrollbar_positions (~300 lines combined)
- GTK scroll handler, overlay drag handlers
- TUI
build_screen_for_tui (~84 lines)
- TUI viewport sync in mod.rs (~50 lines)
- TUI mouse bottom-chrome calculation
These must all agree, and when a new chrome element is added (e.g. breadcrumb bar), every copy must be updated.
Proposed fix
Add render::compute_editor_layout(engine, width, height, line_height) -> EditorLayout that returns a struct with all computed regions (tab_bar_rect, editor_rect, quickfix_rect, terminal_rect, status_rect, etc.). All consumers use this one computation.
Context
Identified in Session 370 backend dedup audit (Tier 2).
Problem
The same editor layout arithmetic (subtract tab bar, quickfix, terminal, debug toolbar, status bar from available space) is computed in multiple places:
draw.rs:122-202(~80 lines) — draw_editormod.rssync_scrollbar + sync_scrollbar_positions (~300 lines combined)build_screen_for_tui(~84 lines)These must all agree, and when a new chrome element is added (e.g. breadcrumb bar), every copy must be updated.
Proposed fix
Add
render::compute_editor_layout(engine, width, height, line_height) -> EditorLayoutthat returns a struct with all computed regions (tab_bar_rect, editor_rect, quickfix_rect, terminal_rect, status_rect, etc.). All consumers use this one computation.Context
Identified in Session 370 backend dedup audit (Tier 2).