Merge branch 'master' of github.com:royqh1979/RedPanda-CPP

This commit is contained in:
Roy Qu 2023-10-18 17:08:07 +08:00
commit daaa97ba76
2 changed files with 20 additions and 1 deletions

View File

@ -57,6 +57,8 @@
QHash<ParserLanguage,std::weak_ptr<CppParser>> 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;

View File

@ -355,6 +355,9 @@ private:
QMap<QString,StatementKind> mIdentCache;
static QHash<ParserLanguage,std::weak_ptr<CppParser>> mSharedParsers;
#ifdef Q_OS_UNIX
static int mShouldDisableSuggestionInInputMethodEvent;
#endif
// QWidget interface
protected: