From 514014dc00bc83b38a80fb717d76e1cf8ead94f1 Mon Sep 17 00:00:00 2001 From: BruebachL <44814898+BruebachL@users.noreply.github.com> Date: Thu, 8 Oct 2026 14:38:11 +0200 Subject: [PATCH] [Completer] Stop line edit rewrite on popup highlight (#7447) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Completer] Stop line edit rewrite on popup highlight * [Completer] Extract the completion index into a variable Make the popup selection update readable at a glance. --------- Co-authored-by: Lukas BrĂ¼bach --- .../src/interface/widgets/utility/card_completer_styler.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/interface/widgets/utility/card_completer_styler.cpp b/cockatrice/src/interface/widgets/utility/card_completer_styler.cpp index 0f1585f3c..fef1dcbf7 100644 --- a/cockatrice/src/interface/widgets/utility/card_completer_styler.cpp +++ b/cockatrice/src/interface/widgets/utility/card_completer_styler.cpp @@ -149,7 +149,8 @@ bool CardCompleterStyler::handlePopupKeyPress(QKeyEvent *event) const int newRow = qBound(0, currentRow + step, rowCount - 1); if (newRow != currentRow) { - popup->setCurrentIndex(completer->completionModel()->index(newRow, completer->completionColumn())); + const QModelIndex newIndex = completer->completionModel()->index(newRow, completer->completionColumn()); + popup->selectionModel()->setCurrentIndex(newIndex, QItemSelectionModel::NoUpdate); } return true; @@ -178,7 +179,8 @@ void CardCompleterStyler::ensureClosestSelected() const int closestRow = rowCount - 1; if (currentRow != closestRow) { - popup->setCurrentIndex(completionModel->index(closestRow, completer->completionColumn())); + popup->selectionModel()->setCurrentIndex(completionModel->index(closestRow, completer->completionColumn()), + QItemSelectionModel::NoUpdate); } }