don't select emoji completion by default and add minimum string length before showing completions
This commit is contained in:
parent
f40d8d15b5
commit
aed8d23aca
@ -250,15 +250,18 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event)
|
|||||||
QTextEdit::keyPressEvent(event);
|
QTextEdit::keyPressEvent(event);
|
||||||
emoji_popup_open_ = true;
|
emoji_popup_open_ = true;
|
||||||
emoji_completion_model_->setFilterRegExp(wordUnderCursor());
|
emoji_completion_model_->setFilterRegExp(wordUnderCursor());
|
||||||
completer_->popup()->setCurrentIndex(completer_->completionModel()->index(0, 0));
|
|
||||||
completer_->complete(completerRect());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Qt::Key_Return:
|
case Qt::Key_Return:
|
||||||
case Qt::Key_Enter:
|
case Qt::Key_Enter:
|
||||||
if (emoji_popup_open_) {
|
if (emoji_popup_open_) {
|
||||||
event->ignore();
|
if (!completer_->popup()->currentIndex().isValid()) {
|
||||||
return;
|
// No completion to select, do normal behavior
|
||||||
|
completer_->popup()->hide();
|
||||||
|
emoji_popup_open_ = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
event->ignore();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(event->modifiers() & Qt::ShiftModifier)) {
|
if (!(event->modifiers() & Qt::ShiftModifier)) {
|
||||||
@ -307,11 +310,9 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event)
|
|||||||
if (isModifier)
|
if (isModifier)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (emoji_popup_open_) {
|
if (emoji_popup_open_ && wordUnderCursor().length() > 2) {
|
||||||
// Update completion
|
// Update completion
|
||||||
emoji_completion_model_->setFilterRegExp(wordUnderCursor());
|
emoji_completion_model_->setFilterRegExp(wordUnderCursor());
|
||||||
completer_->popup()->setCurrentIndex(
|
|
||||||
completer_->completionModel()->index(0, 0));
|
|
||||||
completer_->complete(completerRect());
|
completer_->complete(completerRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user