Skip to content

TUI ext panel: only top section header toggles on click in git_insights (2 of 3 still don't) #499

Description

@JDonaghy

Symptom

After PR for #483/#484/#485 (commit `fdd83ca`), single-click on section headers in plugin-provided extension panels toggles only the top section. Other sections (e.g. Log and Stash in `git_insights`) still don't visibly toggle on click.

Repro

  1. Open the `git_insights` extension panel (3 sections: Branches / Log / Stash).
  2. Click the Branches header → toggles correctly.
  3. Click the Log header → no visible toggle.
  4. Click the Stash header → no visible toggle.

`Tab` on a selected section header still toggles correctly for all three.

What was attempted

The original #484 fix at `src/tui_main/mouse.rs:2299` gated `handle_ext_panel_key("Return", ...)` on `!is_double` to prevent terminal-emitted double-Down events from un-toggling. That fix made one section work but the other two remained broken — so the double-fire theory wasn't the (whole) root cause.

Cause (unknown)

Code review of `ext_panel_flat_to_section`, `ext_panel_flat_len`, and the `Return` handler in `ext_panel.rs:308+` all check out for sections 0/1/2 on paper. The flat-idx math is correct whether sections are expanded or collapsed.

Possible angles for the next agent:

  • Instrument the click handler at mouse.rs:2289+ — log `flat_idx`, the result of `flat_to_section`, and `ext_panel_sections_expanded` before/after. Compare working (Branches) vs non-working (Log/Stash) cases.
  • Check whether the plugin's `set_items` callbacks are re-emitting items in response to a side effect of the click and inadvertently resetting `ext_panel_sections_expanded`.
  • Compare against keyboard `Tab` path — both route through the same engine method, but the click path adds the selection-then-Return sequence. Maybe selection update via the click path produces a different state.

Files

  • `src/tui_main/mouse.rs:2289-2306` — click dispatch
  • `src/core/engine/ext_panel.rs:308-388` — `Return` handler for section headers / expandable items
  • `src/core/engine/ext_panel.rs:98-121` — `flat_to_section`

Notes

Surfaced during smoke testing of the #483/#484/#485 fix branch (`fdd83ca`).

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions