mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
change around variables names to make things a bit more clear
This commit is contained in:
parent
ab42a30108
commit
ad12a818b2
3 changed files with 6 additions and 8 deletions
|
@ -17,7 +17,7 @@ CompletionModel::CompletionModel(const QString &_channelName)
|
||||||
|
|
||||||
void CompletionModel::refresh()
|
void CompletionModel::refresh()
|
||||||
{
|
{
|
||||||
// debug::Log("[CompletionModel:{}] Refreshing...]", this->channelName);
|
debug::Log("[CompletionModel:{}] Refreshing...]", this->channelName);
|
||||||
|
|
||||||
auto &emoteManager = singletons::EmoteManager::getInstance();
|
auto &emoteManager = singletons::EmoteManager::getInstance();
|
||||||
|
|
||||||
|
|
|
@ -99,12 +99,11 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event)
|
||||||
auto *completionModel =
|
auto *completionModel =
|
||||||
static_cast<chatterino::singletons::CompletionModel *>(this->completer->model());
|
static_cast<chatterino::singletons::CompletionModel *>(this->completer->model());
|
||||||
|
|
||||||
if (!this->nextCompletion) {
|
if (!this->completionInProgress) {
|
||||||
|
// First type pressing tab after modifying a message, we refresh our completion model
|
||||||
completionModel->refresh();
|
completionModel->refresh();
|
||||||
this->completer->setModel(completionModel);
|
this->completionInProgress = true;
|
||||||
// first selection
|
|
||||||
this->completer->setCompletionPrefix(currentCompletionPrefix);
|
this->completer->setCompletionPrefix(currentCompletionPrefix);
|
||||||
this->nextCompletion = true;
|
|
||||||
this->completer->complete();
|
this->completer->complete();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +121,7 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event)
|
||||||
// (hemirt)
|
// (hemirt)
|
||||||
// this resets the selection in the completion list, it should probably only trigger on actual
|
// 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)
|
// chat input (space, character) and not on every key input (pressing alt for example)
|
||||||
this->nextCompletion = false;
|
this->completionInProgress = false;
|
||||||
|
|
||||||
if (!event->isAccepted()) {
|
if (!event->isAccepted()) {
|
||||||
QTextEdit::keyPressEvent(event);
|
QTextEdit::keyPressEvent(event);
|
||||||
|
|
|
@ -25,12 +25,11 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QCompleter *completer = nullptr;
|
QCompleter *completer = nullptr;
|
||||||
|
bool completionInProgress = false;
|
||||||
|
|
||||||
// hadSpace is set to true in case the "textUnderCursor" word was after a space
|
// hadSpace is set to true in case the "textUnderCursor" word was after a space
|
||||||
QString textUnderCursor(bool *hadSpace = nullptr) const;
|
QString textUnderCursor(bool *hadSpace = nullptr) const;
|
||||||
|
|
||||||
bool nextCompletion = false;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void insertCompletion(const QString &completion);
|
void insertCompletion(const QString &completion);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue