Skip to content

fix: select search result on right-click before opening context menu - #826

Closed
Bondrewd-K wants to merge 1 commit into
srwi:developfrom
Bondrewd-K:fix/right-click-selects-row
Closed

Bondrewd-K wants to merge 1 commit into
srwi:developfrom
Bondrewd-K:fix/right-click-selects-row

Conversation

@Bondrewd-K

@Bondrewd-K Bondrewd-K commented Nov 6, 2026 •

Copy link
Copy Markdown

Checklist

Summary

Right-clicking a search result no longer acts on whatever row happens to be selected. OnListViewItemMouseDown now syncs the selection to the right-clicked ListViewItem before the context menu opens, so every menu entry — Open, Open Path, Open With, Show in Everything, Copy Full Name, Copy File Name, Copy File, Properties, Run as administrator, Windows context menu, custom actions — targets the row under the cursor. This also fixes the "Run as administrator" visibility check and the Shift+right-click system-menu branch, which read the same selection.

Root cause: the context menu is attached to every ListViewItem, but no right-button handler existed, and WPF does not move selection on right-click — so SelectedSearchResult was always the keyboard/left-click selection, never the right-clicked row.

Related issue

Fixes #825

Type of change

  • Bug fix
  • New feature
  • UI change
  • Documentation update
  • Refactoring / maintenance

Testing

Suggested manual verification (from #825):

  1. With no keyboard selection, right-click the 2nd result → Open With → custom action: it must receive the 2nd row's path (before: nothing happened).
  2. With "Select first result" on, right-click the 2nd row → Copy Full Name: clipboard must hold the 2nd row's path, not the 1st.
  3. Right-click a .exe row vs a .txt row: "Run as administrator" must appear only for the .exe row.
  4. Shift+right-click a non-selected row: the Windows context menu must target that row.
  5. Keyboard Menu key on a selected row: still acts on the selected row (regression check).

Screenshots or recordings

None — the only visible change is the right-clicked row taking the existing selection highlight.

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.

Context menu actions act on the selected result instead of the right-clicked result

1 participant