diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 7ddaa3cb..71787806 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -57,6 +57,8 @@ QHash> Editor::mSharedParsers; +int Editor::mShouldDisableSuggestionInInputMethodEvent = -1; + Editor::Editor(QWidget *parent): Editor(parent,"untitled",ENCODING_AUTO_DETECT,nullptr,true,nullptr) { @@ -1338,7 +1340,21 @@ void Editor::mouseReleaseEvent(QMouseEvent *event) void Editor::inputMethodEvent(QInputMethodEvent *event) { - QSynedit::QSynEdit::inputMethodEvent(event); + QSynedit::QSynEdit::inputMethodEvent(event); +#ifdef Q_OS_UNIX + if (mShouldDisableSuggestionInInputMethodEvent == -1) { + //not inited + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + //input method is ibus, disable suggestion + mShouldDisableSuggestionInInputMethodEvent = + (env.value("QT_IM_MODULE")=="ibus" )? 1 : 0; + } + if (mShouldDisableSuggestionInInputMethodEvent == 1) { + if (pMainWindow->completionPopup()->isVisible()) + pMainWindow->completionPopup()->close(); + return; + } +#endif QString s = event->commitString(); if (s.isEmpty()) return; diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index e98a9534..2e4508e4 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -355,6 +355,9 @@ private: QMap mIdentCache; static QHash> mSharedParsers; +#ifdef Q_OS_UNIX + static int mShouldDisableSuggestionInInputMethodEvent; +#endif // QWidget interface protected: