diff --git a/src/singletons/helper/completionmodel.cpp b/src/singletons/helper/completionmodel.cpp index 34f9d2f96..9c6c3df1a 100644 --- a/src/singletons/helper/completionmodel.cpp +++ b/src/singletons/helper/completionmodel.cpp @@ -17,7 +17,7 @@ CompletionModel::CompletionModel(const QString &_channelName) void CompletionModel::refresh() { - // debug::Log("[CompletionModel:{}] Refreshing...]", this->channelName); + debug::Log("[CompletionModel:{}] Refreshing...]", this->channelName); auto &emoteManager = singletons::EmoteManager::getInstance(); diff --git a/src/widgets/helper/resizingtextedit.cpp b/src/widgets/helper/resizingtextedit.cpp index 7f837d4b2..28db51819 100644 --- a/src/widgets/helper/resizingtextedit.cpp +++ b/src/widgets/helper/resizingtextedit.cpp @@ -99,12 +99,11 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event) auto *completionModel = static_cast(this->completer->model()); - if (!this->nextCompletion) { + if (!this->completionInProgress) { + // First type pressing tab after modifying a message, we refresh our completion model completionModel->refresh(); - this->completer->setModel(completionModel); - // first selection + this->completionInProgress = true; this->completer->setCompletionPrefix(currentCompletionPrefix); - this->nextCompletion = true; this->completer->complete(); return; } @@ -122,7 +121,7 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event) // (hemirt) // this resets the selection in the completion list, it should probably only trigger on actual // chat input (space, character) and not on every key input (pressing alt for example) - this->nextCompletion = false; + this->completionInProgress = false; if (!event->isAccepted()) { QTextEdit::keyPressEvent(event); diff --git a/src/widgets/helper/resizingtextedit.hpp b/src/widgets/helper/resizingtextedit.hpp index 59098b4ca..727e44bda 100644 --- a/src/widgets/helper/resizingtextedit.hpp +++ b/src/widgets/helper/resizingtextedit.hpp @@ -25,12 +25,11 @@ protected: private: QCompleter *completer = nullptr; + bool completionInProgress = false; // hadSpace is set to true in case the "textUnderCursor" word was after a space QString textUnderCursor(bool *hadSpace = nullptr) const; - bool nextCompletion = false; - private slots: void insertCompletion(const QString &completion); };