mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-24 06:14:47 +02:00
Optimize setting image call in auto-completion
In PR #11088 the calling scinitilla is not optimized: SCI_REGISTERIMAGE & SCI_AUTOCSETTYPESEPARATOR need to be called only once.
This commit is contained in:
parent
c394a890aa
commit
6c345e907b
@ -117,9 +117,13 @@ bool AutoCompletion::showApiComplete()
|
|||||||
if (len >= _keyWordMaxLen)
|
if (len >= _keyWordMaxLen)
|
||||||
return false;
|
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_AUTOCSETSEPARATOR, WPARAM(' '));
|
||||||
_pEditView->execute(SCI_AUTOCSETTYPESEPARATOR, WPARAM('?'));
|
|
||||||
_pEditView->execute(SCI_REGISTERIMAGE, FUNC_IMG_ID, LPARAM(xpmfn));
|
|
||||||
_pEditView->execute(SCI_AUTOCSETIGNORECASE, _ignoreCase);
|
_pEditView->execute(SCI_AUTOCSETIGNORECASE, _ignoreCase);
|
||||||
_pEditView->showAutoComletion(curPos - startPos, _keyWords.c_str());
|
_pEditView->showAutoComletion(curPos - startPos, _keyWords.c_str());
|
||||||
|
|
||||||
@ -202,10 +206,13 @@ bool AutoCompletion::showApiAndWordComplete()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make Scintilla show the autocompletion menu
|
// 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_AUTOCSETSEPARATOR, WPARAM(' '));
|
||||||
_pEditView->execute(SCI_AUTOCSETTYPESEPARATOR, WPARAM('?'));
|
|
||||||
_pEditView->execute(SCI_REGISTERIMAGE, FUNC_IMG_ID, LPARAM(xpmfn));
|
|
||||||
_pEditView->execute(SCI_AUTOCSETIGNORECASE, _ignoreCase);
|
_pEditView->execute(SCI_AUTOCSETIGNORECASE, _ignoreCase);
|
||||||
_pEditView->showAutoComletion(curPos - startPos, words.c_str());
|
_pEditView->showAutoComletion(curPos - startPos, words.c_str());
|
||||||
return true;
|
return true;
|
||||||
@ -464,8 +471,6 @@ bool AutoCompletion::showWordComplete(bool autoInsert)
|
|||||||
// Make Scintilla show the autocompletion menu
|
// Make Scintilla show the autocompletion menu
|
||||||
|
|
||||||
_pEditView->execute(SCI_AUTOCSETSEPARATOR, WPARAM(' '));
|
_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->execute(SCI_AUTOCSETIGNORECASE, _ignoreCase);
|
||||||
_pEditView->showAutoComletion(curPos - startPos, words.c_str());
|
_pEditView->showAutoComletion(curPos - startPos, words.c_str());
|
||||||
return true;
|
return true;
|
||||||
|
@ -79,6 +79,7 @@ private:
|
|||||||
LangType _curLang = L_TEXT;
|
LangType _curLang = L_TEXT;
|
||||||
TiXmlDocument *_pXmlFile = nullptr;
|
TiXmlDocument *_pXmlFile = nullptr;
|
||||||
TiXmlElement *_pXmlKeyword = nullptr;
|
TiXmlElement *_pXmlKeyword = nullptr;
|
||||||
|
bool _isFxImageRegistered = false;
|
||||||
|
|
||||||
InsertedMatchedChars _insertedMatchedChars;
|
InsertedMatchedChars _insertedMatchedChars;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user