[UI] Accept current completion when no item selected in popup

This commit is contained in:
Lukas Brübach 2026-10-09 12:34:44 +02:00
parent 1836160538
commit 66efebe87a

View file

@ -88,8 +88,14 @@ void LineEditCompleter::keyPressEvent(QKeyEvent *event)
if (info.completer->popup()->isVisible()) {
event->ignore();
const QModelIndex currentIndex = info.completer->popup()->currentIndex();
QString completionText;
if (currentIndex.isValid()) {
insertCompletion(info.completer, currentIndex.data().toString());
completionText = currentIndex.data().toString();
} else {
completionText = info.completer->currentCompletion();
}
if (!completionText.isEmpty()) {
insertCompletion(info.completer, completionText);
}
hideCompleterPopups();
return;