From e9cf16b7017248d6567fe363efedb42c2ff7b05a Mon Sep 17 00:00:00 2001
From: Tobias Hunger <tobias.hunger@digia.com>
Date: Thu, 6 Feb 2014 18:06:24 +0100
Subject: [PATCH] HistoryCompleter: Do not overwrite text in the FancyLineEdit

Do only set the first item of the completion list if there is no
text in the line edit when the completer gets attached. Otherwise
we might overwrite default values that we actually expect to stick
around.

Task-number: QTCREATORBUG-11291
Change-Id: Iee9aa2a5475b840ede201f306e3b4164c6e88120
Reviewed-by: hjk <hjk121@nokiamail.com>
---
 src/libs/utils/historycompleter.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libs/utils/historycompleter.cpp b/src/libs/utils/historycompleter.cpp
index e47037379d1..687a2b5b07e 100644
--- a/src/libs/utils/historycompleter.cpp
+++ b/src/libs/utils/historycompleter.cpp
@@ -171,7 +171,7 @@ HistoryCompleter::HistoryCompleter(FancyLineEdit *lineEdit, const QString &histo
     d->historyKey = QLatin1String("CompleterHistory/") + historyKey;
     d->list = theSettings->value(d->historyKey).toStringList();
     d->lineEdit = lineEdit;
-    if (d->list.count())
+    if (d->list.count() && lineEdit->text().isEmpty())
         lineEdit->setText(d->list.at(0));
 
     setModel(d);
-- 
GitLab