From 1bad4b2bfb5b68bf3a14db177de24caa9cc16be8 Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Sun, 31 Oct 2021 20:21:04 +0100 Subject: [PATCH] fix(modulo): fix search bar shortcut handling for non-querty layouts. Fix #823 --- espanso-modulo/src/sys/search/search.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/espanso-modulo/src/sys/search/search.cpp b/espanso-modulo/src/sys/search/search.cpp index 0e16d13..a06f796 100644 --- a/espanso-modulo/src/sys/search/search.cpp +++ b/espanso-modulo/src/sys/search/search.cpp @@ -236,6 +236,7 @@ SearchFrame::SearchFrame(const wxString &title, const wxPoint &pos, const wxSize vbox->Add(resultBox, 5, wxEXPAND | wxALL, 0); Bind(wxEVT_CHAR_HOOK, &SearchFrame::OnCharEvent, this, wxID_ANY); + searchBar->Bind(wxEVT_CHAR, &SearchFrame::OnCharEvent, this, wxID_ANY); Bind(wxEVT_TEXT, &SearchFrame::OnQueryChange, this, textId); Bind(wxEVT_LISTBOX_DCLICK, &SearchFrame::OnItemClickEvent, this, resultId); Bind(wxEVT_ACTIVATE, &SearchFrame::OnActivate, this, wxID_ANY); @@ -276,9 +277,9 @@ void SearchFrame::OnCharEvent(wxKeyEvent &event) SelectNext(); } } - else if (event.GetKeyCode() >= 49 && event.GetKeyCode() <= 56) + else if (event.GetUnicodeKey() >= '1' && event.GetUnicodeKey() <= '9') { // Alt + num shortcut - int index = event.GetKeyCode() - 49; + int index = event.GetUnicodeKey() - '1'; if (wxGetKeyState(WXK_ALT)) { if (resultBox->GetItemCount() > index)