Skip to content

Fix #434: action menu opens below trigger button via placement=Below - #442

Merged
JDonaghy merged 2 commits into
developfrom
issue-434-action-menu-placement
May 17, 2026
Merged

Fix #434: action menu opens below trigger button via placement=Below#442
JDonaghy merged 2 commits into
developfrom
issue-434-action-menu-placement

Conversation

@JDonaghy

Copy link
Copy Markdown
Owner

Summary

The editor tab bar action menu opened at the row of the button itself (overlapping the tab row) instead of below it. After PR #427 migrated the action menu from gtk4::PopoverMenu to engine-drawn quadraui::ContextMenu, the click coords were anchored as-is and the adapter never set a placement — quadraui defaulted to AnchorPoint (top-left == click). TUI had been masking the same bug with a row + 1 hack at the call site.

Take option 1 from the issue: thread the trigger element's height through the engine and use ContextMenuPlacement::Below.

  • ContextMenuState gains trigger_height: f32 (line_height units; supports sub-cell rows like GTK's 1.6× tab row). 0.0 = right-click flow → AnchorPoint; non-zero = dropdown-style → Below.
  • open_editor_action_menu(group_id, x, y, trigger_height) — new arg. The four right-click open_* paths default to 0.0.
  • ContextMenuPanel + render builder propagate the field.
  • context_menu_panel_to_quadraui_context_menu sets placement based on trigger_height.
  • Both backends switch from .layout() to .layout_at() with an anchor Rect carrying the trigger height in their native unit.
  • GTK click handler passes tab_row_height_px / line_height (≈1.6) so the menu sits flush against the button with zero gap.
  • TUI call sites drop the row + 1 hack and pass (row, 1.0).

Auto-flip to Above when there's no room below is handled by quadraui's layout_at — vimcode gets it for free.

Test plan

  • cargo build clean
  • cargo test --no-default-features --lib — 1965 passing, 0 failing
  • cargo clippy -- -D warnings clean
  • cargo fmt --check clean
  • Smoke (GTK): action button menu opens flush below the button, no gap; right-click flows still anchor at click point
  • Smoke (TUI): confirmed flush

Closes #434

🤖 Generated with Claude Code

JDonaghy and others added 2 commits May 16, 2026 21:10
The editor tab bar `…` action menu opened at the row of the button
itself (overlapping the tab row) instead of below it. After PR #427
migrated the action menu from gtk4::PopoverMenu to the engine-drawn
quadraui::ContextMenu, the click coords were anchored as-is and the
adapter never set a placement, so quadraui defaulted to AnchorPoint
(menu top-left == click point). TUI had been masking the same bug with
a `row + 1` hack at the call site.

Take option 1 from the issue: thread the trigger element's height
through the engine and use ContextMenuPlacement::Below.

- ContextMenuState gains `trigger_height: u16` (cells). 0 = right-click
  flow → AnchorPoint; non-zero = dropdown-style → Below.
- open_editor_action_menu(group_id, x, y, trigger_height) — new arg.
  The four right-click open_* functions default trigger_height to 0.
- ContextMenuPanel + render builder propagate the field.
- context_menu_panel_to_quadraui_context_menu sets placement based on
  trigger_height.
- Both backends switch from `.layout()` to `.layout_at()` with an
  anchor Rect carrying the trigger height in their native unit
  (line_height px for GTK, 1 cell for TUI).
- GTK click handler computes trigger height from tab_row_height_px /
  line_height (ceiled) — about 2 cells. The sub-cell rounding leaves a
  small gap below the button rather than overlap; cleaning that up is
  #168's job.
- TUI call sites drop the `row + 1` hack and pass row + height=1.

Auto-flip to Above when there's no room below is handled by quadraui's
layout_at; vimcode gets it for free.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The first cut rounded trigger_height to whole cells, which left ~8px
of empty space below GTK's tab row (1.6 line_heights rounded up to 2).
Switch trigger_height from u16 to f32 (line_height units) so the GTK
caller can pass the exact 1.6 ratio and the menu sits flush against
the button bottom. TUI stays at 1.0 (one row).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@JDonaghy
JDonaghy merged commit 4ebf5fa into develop May 17, 2026
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.

1 participant