[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [ktexteditor] src/vimode: Make SearchHistory use the new Completion approach.
From:       Simon St James <kdedevel () etotheipiplusone ! com>
Date:       2016-06-17 8:18:09
Message-ID: E1bDoyf-0002ZN-Kv () scm ! kde ! org
[Download RAW message or body]

Git commit 3607f91281f3b03479d65ddbd17cd6937cde1c9b by Simon St James.
Committed on 17/06/2016 at 08:14.
Pushed by sstjames into branch 'master'.

Make SearchHistory use the new Completion approach.

M  +8    -8    src/vimode/emulatedcommandbar.cpp
M  +1    -1    src/vimode/emulatedcommandbar.h

http://commits.kde.org/ktexteditor/3607f91281f3b03479d65ddbd17cd6937cde1c9b

diff --git a/src/vimode/emulatedcommandbar.cpp b/src/vimode/emulatedcommandbar.cpp
index ab41559..418a051 100644
--- a/src/vimode/emulatedcommandbar.cpp
+++ b/src/vimode/emulatedcommandbar.cpp
@@ -600,12 +600,14 @@ void EmulatedCommandBar::replaceCommandBeforeCursorWith(const \
QString &newComman  m_edit->setText(newText);
 }
 
-void EmulatedCommandBar::activateSearchHistoryCompletion()
+EmulatedCommandBar::CompletionStartParams \
EmulatedCommandBar::activateSearchHistoryCompletion()  {
     m_currentCompletionType = SearchHistory;
-    m_completionModel->setStringList(reversed(m_viInputModeManager->globalState()->searchHistory()->items()));
                
-    updateCompletionPrefix();
-    m_completer->complete();
+    CompletionStartParams completionStartParams;
+    completionStartParams.completions = \
reversed(m_viInputModeManager->globalState()->searchHistory()->items()); +    \
completionStartParams.shouldStart = true; +    completionStartParams.wordStartPos = \
0; +    return completionStartParams;
 }
 
 void EmulatedCommandBar::activateWordFromDocumentCompletion()
@@ -719,8 +721,6 @@ void EmulatedCommandBar::currentCompletionChanged()
     m_isNextTextChangeDueToCompletionChange = true;
     if (m_currentCompletionType == WordFromDocument) {
         replaceWordBeforeCursorWith(newCompletion);
-    } else if (m_currentCompletionType == SearchHistory) {
-        m_edit->setText(newCompletion);
     } else if (m_currentCompletionType == Commands) {
         const int newCursorPosition = m_edit->cursorPosition() + \
(newCompletion.length() - commandBeforeCursor().length());  \
replaceCommandBeforeCursorWith(newCompletion); @@ -888,7 +888,7 @@ bool \
                EmulatedCommandBar::handleKeyPress(const QKeyEvent *keyEvent)
                     completionStartParams = activateCommandHistoryCompletion();
                 }
             } else {
-                activateSearchHistoryCompletion();
+                completionStartParams = activateSearchHistoryCompletion();
             }
             m_currentCompletionStartParams = completionStartParams;
             if (completionStartParams.shouldStart)
@@ -917,7 +917,7 @@ bool EmulatedCommandBar::handleKeyPress(const QKeyEvent \
*keyEvent)  if (m_mode == Command) {
                 completionStartParams = activateCommandHistoryCompletion();
             } else {
-                activateSearchHistoryCompletion();
+                completionStartParams = activateSearchHistoryCompletion();
             }
             m_currentCompletionStartParams = completionStartParams;
             if (completionStartParams.shouldStart)
diff --git a/src/vimode/emulatedcommandbar.h b/src/vimode/emulatedcommandbar.h
index ceb48c9..f8560be 100644
--- a/src/vimode/emulatedcommandbar.h
+++ b/src/vimode/emulatedcommandbar.h
@@ -171,7 +171,7 @@ private:
     void replaceWordBeforeCursorWith(const QString &newWord);
     void replaceCommandBeforeCursorWith(const QString &newCommand);
 
-    void activateSearchHistoryCompletion();
+    CompletionStartParams activateSearchHistoryCompletion();
     void activateWordFromDocumentCompletion();
     void activateCommandCompletion();
     CompletionStartParams activateCommandHistoryCompletion();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic