Fix #434: action menu opens below trigger button via placement=Below - #442
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 fromgtk4::PopoverMenuto engine-drawnquadraui::ContextMenu, the click coords were anchored as-is and the adapter never set a placement — quadraui defaulted toAnchorPoint(top-left == click). TUI had been masking the same bug with arow + 1hack at the call site.Take option 1 from the issue: thread the trigger element's height through the engine and use
ContextMenuPlacement::Below.ContextMenuStategainstrigger_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-clickopen_*paths default to 0.0.ContextMenuPanel+ render builder propagate the field.context_menu_panel_to_quadraui_context_menusets placement based ontrigger_height..layout()to.layout_at()with an anchorRectcarrying the trigger height in their native unit.tab_row_height_px / line_height(≈1.6) so the menu sits flush against the button with zero gap.row + 1hack and pass(row, 1.0).Auto-flip to
Abovewhen there's no room below is handled by quadraui'slayout_at— vimcode gets it for free.Test plan
cargo buildcleancargo test --no-default-features --lib— 1965 passing, 0 failingcargo clippy -- -D warningscleancargo fmt --checkcleanCloses #434
🤖 Generated with Claude Code