mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Fixes #326 Shift + EMOTE TAB doesnt work
This commit is contained in:
parent
b23b583cb3
commit
efdcc64f89
|
@ -75,13 +75,8 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event)
|
|||
|
||||
this->keyPressed.invoke(event);
|
||||
|
||||
if (event->key() == Qt::Key_Backtab) {
|
||||
// Ignore for now. We want to use it for autocomplete later
|
||||
return;
|
||||
}
|
||||
|
||||
bool doComplete =
|
||||
event->key() == Qt::Key_Tab && (event->modifiers() & Qt::ControlModifier) == Qt::NoModifier;
|
||||
bool doComplete = (event->key() == Qt::Key_Tab || event->key() == Qt::Key_Backtab) &&
|
||||
(event->modifiers() & Qt::ControlModifier) == Qt::NoModifier;
|
||||
|
||||
if (doComplete) {
|
||||
// check if there is a completer
|
||||
|
@ -110,10 +105,17 @@ void ResizingTextEdit::keyPressEvent(QKeyEvent *event)
|
|||
}
|
||||
|
||||
// scrolling through selections
|
||||
if (event->key() == Qt::Key_Tab) {
|
||||
if (!this->completer->setCurrentRow(this->completer->currentRow() + 1)) {
|
||||
// wrap over and start again
|
||||
this->completer->setCurrentRow(0);
|
||||
}
|
||||
} else {
|
||||
if (!this->completer->setCurrentRow(this->completer->currentRow() - 1)) {
|
||||
// wrap over and start again
|
||||
this->completer->setCurrentRow(this->completer->completionCount() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
this->completer->complete();
|
||||
return;
|
||||
|
@ -122,7 +124,13 @@ 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)
|
||||
// (fourtf)
|
||||
// fixed for shift+tab, there might be a better solution but nobody is gonna bother anyways
|
||||
if (event->key() != Qt::Key_Shift && event->key() != Qt::Key_Control &&
|
||||
event->key() != Qt::Key_Alt && event->key() != Qt::Key_Super_L &&
|
||||
event->key() != Qt::Key_Super_R) {
|
||||
this->completionInProgress = false;
|
||||
}
|
||||
|
||||
if (!event->isAccepted()) {
|
||||
QTextEdit::keyPressEvent(event);
|
||||
|
|
Loading…
Reference in a new issue