diff --git a/PowerEditor/src/ScintillaComponent/AutoCompletion.cpp b/PowerEditor/src/ScintillaComponent/AutoCompletion.cpp index 77f3cee65..e8708e45d 100644 --- a/PowerEditor/src/ScintillaComponent/AutoCompletion.cpp +++ b/PowerEditor/src/ScintillaComponent/AutoCompletion.cpp @@ -117,9 +117,13 @@ bool AutoCompletion::showApiComplete() if (len >= _keyWordMaxLen) return false; + if (!_isFxImageRegistered) + { + _pEditView->execute(SCI_AUTOCSETTYPESEPARATOR, WPARAM('?')); + _pEditView->execute(SCI_REGISTERIMAGE, FUNC_IMG_ID, LPARAM(xpmfn)); + _isFxImageRegistered = true; + } _pEditView->execute(SCI_AUTOCSETSEPARATOR, WPARAM(' ')); - _pEditView->execute(SCI_AUTOCSETTYPESEPARATOR, WPARAM('?')); - _pEditView->execute(SCI_REGISTERIMAGE, FUNC_IMG_ID, LPARAM(xpmfn)); _pEditView->execute(SCI_AUTOCSETIGNORECASE, _ignoreCase); _pEditView->showAutoComletion(curPos - startPos, _keyWords.c_str()); @@ -202,10 +206,13 @@ bool AutoCompletion::showApiAndWordComplete() } // Make Scintilla show the autocompletion menu - + if (!_isFxImageRegistered) + { + _pEditView->execute(SCI_AUTOCSETTYPESEPARATOR, WPARAM('?')); + _pEditView->execute(SCI_REGISTERIMAGE, FUNC_IMG_ID, LPARAM(xpmfn)); + _isFxImageRegistered = true; + } _pEditView->execute(SCI_AUTOCSETSEPARATOR, WPARAM(' ')); - _pEditView->execute(SCI_AUTOCSETTYPESEPARATOR, WPARAM('?')); - _pEditView->execute(SCI_REGISTERIMAGE, FUNC_IMG_ID, LPARAM(xpmfn)); _pEditView->execute(SCI_AUTOCSETIGNORECASE, _ignoreCase); _pEditView->showAutoComletion(curPos - startPos, words.c_str()); return true; @@ -464,8 +471,6 @@ bool AutoCompletion::showWordComplete(bool autoInsert) // Make Scintilla show the autocompletion menu _pEditView->execute(SCI_AUTOCSETSEPARATOR, WPARAM(' ')); - _pEditView->execute(SCI_AUTOCSETTYPESEPARATOR, WPARAM('?')); - _pEditView->execute(SCI_REGISTERIMAGE, FUNC_IMG_ID, LPARAM(xpmfn)); _pEditView->execute(SCI_AUTOCSETIGNORECASE, _ignoreCase); _pEditView->showAutoComletion(curPos - startPos, words.c_str()); return true; diff --git a/PowerEditor/src/ScintillaComponent/AutoCompletion.h b/PowerEditor/src/ScintillaComponent/AutoCompletion.h index 6b0eb0f3a..44fe75290 100644 --- a/PowerEditor/src/ScintillaComponent/AutoCompletion.h +++ b/PowerEditor/src/ScintillaComponent/AutoCompletion.h @@ -79,6 +79,7 @@ private: LangType _curLang = L_TEXT; TiXmlDocument *_pXmlFile = nullptr; TiXmlElement *_pXmlKeyword = nullptr; + bool _isFxImageRegistered = false; InsertedMatchedChars _insertedMatchedChars;