Skip to content

Unify result context menus between grid and list layouts#905

Merged
multiplex55 merged 1 commit intomasterfrom
codex/extract-context-menu-logic-to-helper-method
Feb 22, 2026
Merged

Unify result context menus between grid and list layouts#905
multiplex55 merged 1 commit intomasterfrom
codex/extract-context-menu-logic-to-helper-method

Conversation

@multiplex55
Copy link
Owner

Motivation

  • Ensure grid-mode result tiles expose the same context-menu actions and side effects as list-mode items to avoid parity bugs and duplicated logic.
  • Reduce duplication by extracting the branch-heavy list-mode menu construction into a shared helper so future menu changes only need one place to be updated.
  • Preserve existing activation/geometry behavior (left-click activation, grid cols/col_width/ui.end_row) while keeping refresh/focus side effects intact.

Description

  • Added a ResultContextMenuKind enum to classify actionable result kinds (folder, bookmark, timer, stopwatch, snippet, tempfile, note, clipboard, todo, default).
  • Implemented result_context_menu_kind(&self, action: &Action) -> ResultContextMenuKind to deterministically map Action entries to menu kinds.
  • Implemented attach_result_context_menu(&mut self, action: &Action, menu_resp: egui::Response, refresh: &mut bool, set_focus: &mut bool) -> egui::Response that builds the full context menu UI and preserves all branch-specific behaviors (folders, bookmarks, notes/todos, snippets, timers/stopwatches, clipboard entries, Edit App, pin/unpin) and mutates refresh/set_focus when appropriate.
  • Updated grid rendering so each tile Response is passed through attach_result_context_menu before click handling; list rendering also now uses the same helper (menu geometry and left-click activation unchanged).
  • Added focused tests in the module to capture parity/regression intent: grid_context_menu_eligibility_uses_result_actions, context_menu_parity_bookmark_between_list_and_grid, and context_menu_parity_todo_between_list_and_grid.

Testing

  • Ran cargo fmt to format the code and succeeded.
  • Added unit tests that exercise the pure helper (result_context_menu_kind) and assert parity between list and grid classifications.
  • Attempted to run targeted tests (cargo test grid_context_menu -- --nocapture), but the build failed due to a missing system dependency for a transitive crate: the system alsa pkg-config file (alsa.pc) is not available in this environment, causing the test run to error before tests could execute.

Codex Task

@multiplex55 multiplex55 merged commit a2dff44 into master Feb 22, 2026
1 check passed
@multiplex55 multiplex55 deleted the codex/extract-context-menu-logic-to-helper-method branch February 23, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant