Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Don't use QCompleter prefix filter #4855

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,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)
- Dev: Fixed UTF16 encoding of `modes` file for the installer. (#4791)
- Dev: Temporarily disable High DPI scaling on Qt6 builds on Windows. (#4767)
- Dev: Tests now run on Ubuntu 22.04 instead of 20.04 to loosen C++ restrictions in tests. (#4774)
Expand Down
16 changes: 3 additions & 13 deletions src/widgets/helper/ResizingTextEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event)
return;
}

QString currentCompletionPrefix = this->textUnderCursor();
QString currentCompletion = this->textUnderCursor();
Felanbird marked this conversation as resolved.
Show resolved Hide resolved

// check if there is something to complete
if (currentCompletionPrefix.size() <= 1)
if (currentCompletion.size() <= 1)
{
return;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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<void (QCompleter::*)(const QString &)>(
&QCompleter::highlighted),
Expand Down