From c2f2247ae32e82fc29bf9af5fb49e7a586c810cc Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 28 Jun 2023 00:04:50 +0100 Subject: [PATCH] Don't process SCINTILLA_TRICKS onCharHook when autocomplete is active. (ESC being the exception that proves the rule.) Fixes https://gitlab.com/kicad/code/kicad/-/issues/15001 --- common/scintilla_tricks.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/common/scintilla_tricks.cpp b/common/scintilla_tricks.cpp index eb31fec860..9546c8f880 100644 --- a/common/scintilla_tricks.cpp +++ b/common/scintilla_tricks.cpp @@ -173,6 +173,21 @@ void SCINTILLA_TRICKS::onCharHook( wxKeyEvent& aEvent ) { wxString c = aEvent.GetUnicodeKey(); + if( m_te->AutoCompActive() ) + { + if( aEvent.GetKeyCode() == WXK_ESCAPE ) + { + m_te->AutoCompCancel(); + m_suppressAutocomplete = true; // Don't run autocomplete again on the next char... + } + else + { + aEvent.Skip(); + } + + return; + } + if( !isalpha( aEvent.GetKeyCode() ) ) m_suppressAutocomplete = false; @@ -274,18 +289,6 @@ void SCINTILLA_TRICKS::onCharHook( wxKeyEvent& aEvent ) if( m_te->GetSelectionEnd() > m_te->GetSelectionStart() ) m_te->DeleteBack(); } - else if( aEvent.GetKeyCode() == WXK_ESCAPE ) - { - if( m_te->AutoCompActive() ) - { - m_te->AutoCompCancel(); - m_suppressAutocomplete = true; // Don't run autocomplete again on the next char... - } - else - { - aEvent.Skip(); - } - } else if( isCtrlSlash( aEvent ) ) { int startLine = m_te->LineFromPosition( m_te->GetSelectionStart() );