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

List:       kde-commits
Subject:    [ktexteditor] src/vimode: Deal with deactivating the CommandMode in the same way as we deal with dea
From:       Simon St James <kdedevel () etotheipiplusone ! com>
Date:       2016-06-17 8:18:10
Message-ID: E1bDoyg-0002ZN-6e () scm ! kde ! org
[Download RAW message or body]

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

Deal with deactivating the CommandMode in the same way as we deal with deactivating \
the SearchMode.

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

http://commits.kde.org/ktexteditor/48f72f7999967f2bedc7c4e8b95be531a1bcf1f5

diff --git a/src/vimode/emulatedcommandbar.cpp b/src/vimode/emulatedcommandbar.cpp
index a868873..dad7847 100644
--- a/src/vimode/emulatedcommandbar.cpp
+++ b/src/vimode/emulatedcommandbar.cpp
@@ -407,14 +407,7 @@ void EmulatedCommandBar::closed()
     if (m_mode == SearchForward || m_mode == SearchBackward) {
         m_searchMode->deactivate(m_wasAborted);
     } else {
-        if (m_wasAborted) {
-            // Appending the command to the history when it is executed is handled \
                elsewhere; we can't
-            // do it inside closed() as we may still be showing the command response \
                display.
-            m_viInputModeManager->globalState()->commandHistory()->append(m_edit->text());
                
-            // With Vim, aborting a command returns us to Normal mode, even if we \
                were in Visual Mode.
-            // If we switch from Visual to Normal mode, we need to clear the \
                selection.
-            m_view->clearSelection();
-        }
+        m_commandMode->deactivate(m_wasAborted);
     }
 }
 
@@ -1231,6 +1224,19 @@ void EmulatedCommandBar::CommandMode::editTextChanged ( const \
QString& newText )  }
 }
 
+void EmulatedCommandBar::CommandMode::deactivate ( bool wasAborted )
+{
+    if (wasAborted) {
+        // Appending the command to the history when it is executed is handled \
elsewhere; we can't +        // do it inside closed() as we may still be showing the \
command response display. +        \
m_viInputModeManager->globalState()->commandHistory()->append(m_edit->text()); +      \
// With Vim, aborting a command returns us to Normal mode, even if we were in Visual \
Mode. +        // If we switch from Visual to Normal mode, we need to clear the \
selection. +        m_view->clearSelection();
+    }
+
+}
+
 EmulatedCommandBar::CompletionStartParams \
EmulatedCommandBar::CommandMode::completionInvoked(EmulatedCommandBar::CompletionInvocation \
invocationType)  {
     CompletionStartParams completionStartParams;
diff --git a/src/vimode/emulatedcommandbar.h b/src/vimode/emulatedcommandbar.h
index aa145bf..2e6ca83 100644
--- a/src/vimode/emulatedcommandbar.h
+++ b/src/vimode/emulatedcommandbar.h
@@ -231,6 +231,7 @@ private:
         void setViInputModeManager(InputModeManager *viInputModeManager);
         virtual bool handleKeyPress ( const QKeyEvent* keyEvent );
         void editTextChanged(const QString &newText);
+        void deactivate(bool wasAborted);
         QString executeCommand(const QString &commandToExecute);
         CompletionStartParams completionInvoked(CompletionInvocation \
invocationType);  void completionChosen();


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

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