Merge branch 'Cody/Dictionary/RightClick' into 'main'

Cody/Dictionary: Select an item with a right mouse click

See merge request freepascal.org/lazarus/lazarus!508
This commit is contained in:
Maxim Ganetsky 2025-06-25 23:25:22 +03:00
commit 1de4c81f7a

View File

@ -1050,6 +1050,11 @@ procedure TCodyIdentifiersDlg.ItemsListBoxContextPopup(Sender: TObject;
var
Identifier, UnitFilename, GroupName, GroupFilename: string;
begin
// when calling the menu from keyboard, the MousePos is (-1;-1)
if not InvalidPoint(MousePos) then
// select item under mouse
ItemsListBox.ItemIndex := ItemsListBox.ItemAtPos(MousePos, true);
// show popup menu only if valid identificator is selected
Handled := not FindSelectedItem(Identifier, UnitFilename, GroupName, GroupFilename);
if Handled then exit;