From 653a14c76b10ae7b162f18df0486d7e3d1212056 Mon Sep 17 00:00:00 2001 From: Daniel Sage <24928223+dnsge@users.noreply.github.com> Date: Fri, 13 Oct 2023 05:22:48 -0400 Subject: [PATCH] fix: Don't use QCompleter prefix filter (#4855) * Invalidate tab completion model when settings change * Remove true culprit * Update CHANGELOG.md * Remove QCompleter setFilterMode call --------- Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com> --- CHANGELOG.md | 1 + src/widgets/helper/ResizingTextEdit.cpp | 16 +++------------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc47ac40..2b107fb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - Bugfix: Fixed input in reply thread popup losing focus when dragging. (#4815) - Bugfix: Fixed the Quick Switcher (CTRL+K) from sometimes showing up on the wrong window. (#4819) - Bugfix: Fixed too much text being copied when copying chat messages. (#4812, #4830, #4839) +- Bugfix: Fixed an issue where the setting `Only search for emote autocompletion at the start of emote names` wouldn't disable if it was enabled when the client started. (#4855) - Bugfix: Fixed empty page being added when showing out of bounds dialog. (#4849) - Bugfix: Fixed issue on Windows preventing the title bar from being dragged in the top left corner. (#4873) - Bugfix: Fixed an issue where reply context didn't render correctly if an emoji was touching text. (#4875) diff --git a/src/widgets/helper/ResizingTextEdit.cpp b/src/widgets/helper/ResizingTextEdit.cpp index 1f400ee4..8012e195 100644 --- a/src/widgets/helper/ResizingTextEdit.cpp +++ b/src/widgets/helper/ResizingTextEdit.cpp @@ -152,10 +152,10 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event) return; } - QString currentCompletionPrefix = this->textUnderCursor(); + QString currentCompletion = this->textUnderCursor(); // check if there is something to complete - if (currentCompletionPrefix.size() <= 1) + if (currentCompletion.size() <= 1) { return; } @@ -170,13 +170,12 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event) // First type pressing tab after modifying a message, we refresh our // completion model this->completer_->setModel(completionModel); - completionModel->updateResults(currentCompletionPrefix, + completionModel->updateResults(currentCompletion, this->isFirstWord()); this->completionInProgress_ = true; { // this blocks cursor movement events from resetting tab completion QSignalBlocker dontTriggerCursorMovement(this); - this->completer_->setCompletionPrefix(currentCompletionPrefix); this->completer_->complete(); } return; @@ -260,15 +259,6 @@ void ResizingTextEdit::setCompleter(QCompleter *c) this->completer_->setCompletionMode(QCompleter::InlineCompletion); this->completer_->setCaseSensitivity(Qt::CaseInsensitive); - if (getSettings()->prefixOnlyEmoteCompletion) - { - this->completer_->setFilterMode(Qt::MatchStartsWith); - } - else - { - this->completer_->setFilterMode(Qt::MatchContains); - } - QObject::connect(completer_, static_cast( &QCompleter::highlighted),