From 2b6a1689726201c3498f8f021e2ef838143d8757 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= <thorbjorn.lindeijer@nokia.com>
Date: Mon, 23 Nov 2009 20:42:31 +0100
Subject: [PATCH] Don't wrap around the completion list when auto-repeating

It can be a bit disturbing if the list suddenly jumps when you don't
release the down or up key in time.

Done with mae.
---
 src/plugins/texteditor/completionwidget.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/plugins/texteditor/completionwidget.cpp b/src/plugins/texteditor/completionwidget.cpp
index 7cdbac8577d..bb6cf900f4e 100644
--- a/src/plugins/texteditor/completionwidget.cpp
+++ b/src/plugins/texteditor/completionwidget.cpp
@@ -166,14 +166,16 @@ bool CompletionWidget::event(QEvent *e)
                 closeList(currentIndex());
             return true;
         case Qt::Key_Up:
-            if (currentIndex().row() == 0) {
+            if (!ke->isAutoRepeat()
+                && currentIndex().row() == 0) {
                 setCurrentIndex(model()->index(model()->rowCount()-1, 0));
                 return true;
             }
             forwardKeys = false;
             break;
         case Qt::Key_Down:
-            if (currentIndex().row() == model()->rowCount()-1) {
+            if (!ke->isAutoRepeat()
+                && currentIndex().row() == model()->rowCount()-1) {
                 setCurrentIndex(model()->index(0, 0));
                 return true;
             }
-- 
GitLab