- fix: Crash while input using input method in makefile

This commit is contained in:
Roy Qu 2022-12-28 09:24:54 +08:00
parent 61a5d9f94f
commit bcb6069fe3
2 changed files with 3 additions and 2 deletions

View File

@ -2,6 +2,7 @@ Red Panda C++ Version 2.8
- fix: Crash when editing makefile - fix: Crash when editing makefile
- enhancement: Add "Resources" in project option's dialog's custom compiler parameter page - enhancement: Add "Resources" in project option's dialog's custom compiler parameter page
- fix: Crash while input using input method in makefile
Red Panda C++ Version 2.7 Red Panda C++ Version 2.7

View File

@ -1319,7 +1319,7 @@ void Editor::inputMethodEvent(QInputMethodEvent *event)
&& pSettings->codeCompletion().showCompletionWhileInput() ) { && pSettings->codeCompletion().showCompletionWhileInput() ) {
if (mLastIdCharPressed>=pSettings->codeCompletion().minCharRequired()) { if (mLastIdCharPressed>=pSettings->codeCompletion().minCharRequired()) {
QString lastWord = getPreviousWordAtPositionForSuggestion(caretXY()); QString lastWord = getPreviousWordAtPositionForSuggestion(caretXY());
if (!lastWord.isEmpty()) { if (mParser && !lastWord.isEmpty()) {
if (CppTypeKeywords.contains(lastWord)) { if (CppTypeKeywords.contains(lastWord)) {
return; return;
} }
@ -3515,7 +3515,7 @@ bool Editor::onCompletionInputMethod(QInputMethodEvent *event)
if (!mCompletionPopup->isVisible()) if (!mCompletionPopup->isVisible())
return processed; return processed;
QString s=event->commitString(); QString s=event->commitString();
if (!s.isEmpty()) { if (mParser && !s.isEmpty()) {
QString phrase = getWordForCompletionSearch(caretXY(),mCompletionPopup->memberOperator()=="::"); QString phrase = getWordForCompletionSearch(caretXY(),mCompletionPopup->memberOperator()=="::");
mLastIdCharPressed = phrase.length(); mLastIdCharPressed = phrase.length();
mCompletionPopup->search(phrase, false); mCompletionPopup->search(phrase, false);