From 1cca824d6690b308f19519594188eafdf69af2c8 Mon Sep 17 00:00:00 2001 From: "S. Razi Alavizadeh" Date: Wed, 7 Aug 2013 02:02:06 +0430 Subject: [PATCH] [LocationBar] Don't move the cursor to the end if inline completion is empty. --- src/lib/navigation/locationbar.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/navigation/locationbar.cpp b/src/lib/navigation/locationbar.cpp index 7407f5ea0..5f253112e 100644 --- a/src/lib/navigation/locationbar.cpp +++ b/src/lib/navigation/locationbar.cpp @@ -447,11 +447,12 @@ void LocationBar::keyPressEvent(QKeyEvent* event) break; case Qt::Key_End: - case Qt::Key_Right: - if (m_inlineCompletionVisible) { + case Qt::Key_Right: { + const QString &completionText = m_completer.domainCompletion(); + if (m_inlineCompletionVisible && !completionText.isEmpty()) { m_inlineCompletionVisible = false; - setText(text() + m_completer.domainCompletion()); + setText(text() + completionText); setCursorPosition(text().size()); m_completer.closePopup(); } @@ -460,6 +461,7 @@ void LocationBar::keyPressEvent(QKeyEvent* event) m_completer.closePopup(); } break; + } case Qt::Key_Left: if (m_completer.isPopupVisible()) {