Skip to content

Extract render::compute_editor_layout() to eliminate repeated layout arithmetic #386

Description

@JDonaghy

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).

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

    enhancementNew feature or requestinfrastructureBuild, CI, distributionuiUI/rendering

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions