Skip to content

Converge the mouse ladder slice 6: delete handle_mouse's remains and GTK's handle_mouse_*_msg #756

Description

@JDonaghy

Continuation of #733, slice 6 of 6. #733 declared a 6-slice plan and was
closed when slice 1's PR merged — the remaining slices were never filed. This issue is
one of them. Measured on develop @ 44882e9 (2026-09-02):

handle_mouse (src/tui_main/mouse.rs) 3,044 · handle_mouse_event
(src/tui_main/shell_app.rs) 365 · handle_mouse_click_msg (src/gtk/mod.rs) 919 ·
handle_mouse_drag_msg 356 · try_route_sidebar_mouse_event 1774,861 lines total,
against the 4,994 #733 was filed on. Slice 1 converged 133.

Locate everything below by symbol, not by line number#733's own body warns that
its numbers drift, and they already have.

The closing slice

Slices 2a–5 move every rung into src/render.rs. This one deletes what is left and makes
the convergence permanent:

  • handle_mouse (src/tui_main/mouse.rs) — gone, or a translate-and-delegate shim under
    ~150 lines.
  • handle_mouse_click_msg, handle_mouse_drag_msg, try_route_sidebar_mouse_event
    (src/gtk/mod.rs) — same.
  • handle_mouse_event (src/tui_main/shell_app.rs) — same.

Acceptance, in addition to the inherited block

  • The five entry points total under 800 lines, from 4,861 at the time of filing. State
    the number.
  • A test asserting both backends resolve the same ScreenLayout + point to the same
    route
    , verified RED by reordering one rung on one backend — the mouse twin of the
    FrameOp-sequence test Converge frame composition — ~4,500 lines laying down the same surfaces in two hand-kept orders #735 asks for. Without this, the ladder re-forks the first time
    someone adds a surface.
  • No rung remains that one backend arbitrates and the other does not, or each surviving
    asymmetry carries a comment saying why it is genuinely one-sided (the folder picker is the
    known legitimate case — GTK uses a native chooser).

Acceptance criteria

Inherited verbatim from #733 — these are the rules that make a slice done:

  • The rung is implemented once, in shared code (src/render.rs), and called from both
    backends.
  • Both backends' bespoke arms for that rung are deleted in the same PR. A migration that
    leaves both paths is not done (GOALS.md, "How to use this doc").
  • Black-box coverage on both backendsTuiDriver via driver_with_shell(TuiShellApp, …)
    in src/tui_main/shell_app.rs, and GtkDriver in src/gtk/testing.rs. Assert on rendered
    output
    , never on state being populated (CLAUDE.md rule 1).
  • The PR states the new tests were verified RED against unfixed develop (CLAUDE.md rule 2).
  • Combined production line count of the entry points above strictly decreases; the PR states
    before/after. (Converge the two mouse routers — ~4,800 lines implementing the same precedence ladder twice #733 slice 1 met this only barely — 4,994 → 4,861 — and Converge frame composition — ~4,500 lines laying down the same surfaces in two hand-kept orders #735 slice 1 did not
    meet it at all. State the numbers.)
  • cargo build && cargo test && cargo clippy -- -D warnings && cargo fmt --check EXIT=0.

Scope discipline

This is one slice. Do not attempt the rungs belonging to the sibling issues listed in
Sequencing — they conflict in the same files and are queued behind this one on purpose.

Files

  • src/render.rs (the shared router)
  • src/tui_main/mouse.rs, src/tui_main/shell_app.rs
  • src/gtk/mod.rs
  • src/gtk/testing.rs (GtkDriver coverage)

Sequencing

Last of the #733 chain — after slices 2a, 2, 3, 4 and 5.

Milestone

#7 Platform-Neutral

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

    coordTracked by coord-tui pipelineenhancementNew feature or requeststatus:readyRefined and ready to enter the work pipelinesub-taskSub-task of a parent issuetier:largeMulti-module / algorithm-heavy work. Routes to opus via models.labels.uiUI/rendering

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions