From 3ce094e474a47b0f77ce1ffcf566f6ff36d924dc Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Thu, 15 Jan 2009 16:42:10 +0100
Subject: [PATCH] fakevim: improve logic for setting the '<' mark

---
 src/plugins/fakevim/fakevimhandler.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index 29f8c323d1f..087d225207f 100644
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -384,6 +384,9 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
         return;
     }
 
+    if (m_visualMode != NoVisualMode)
+        m_marks['>'] = m_tc.position();
+
     if (m_submode == ChangeSubMode) {
         if (!dotCommand.isEmpty())
             m_dotCommand = "c" + dotCommand;
@@ -615,10 +618,8 @@ bool FakeVimHandler::Private::handleCommandMode(int key, const QString &text)
     } else if (key == ':') {
         m_mode = ExMode;
         m_commandBuffer.clear();
-        if (m_visualMode != NoVisualMode) {
+        if (m_visualMode != NoVisualMode)
             m_commandBuffer = "'<,'>";
-            leaveVisualMode();
-        }
         m_commandHistory.append(QString());
         m_commandHistoryIndex = m_commandHistory.size() - 1;
         updateMiniBuffer();
@@ -640,7 +641,6 @@ bool FakeVimHandler::Private::handleCommandMode(int key, const QString &text)
         m_submode = FilterSubMode;
     } else if (key == '!' && m_visualMode == VisualLineMode) {
         m_mode = ExMode;
-        m_marks['>'] = m_tc.position();
         m_commandBuffer = "'<,'>!";
         m_commandHistory.append(QString());
         m_commandHistoryIndex = m_commandHistory.size() - 1;
@@ -1021,6 +1021,7 @@ bool FakeVimHandler::Private::handleMiniBufferModes(int key, const QString &text
             m_commandHistory.takeLast();
             m_commandHistory.append(m_commandBuffer);
             handleExCommand(m_commandBuffer);
+            leaveVisualMode();
         }
     } else if (key == Key_Return && isSearchMode()) {
         if (!m_commandBuffer.isEmpty()) {
@@ -1140,7 +1141,6 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
     if (cmd.startsWith("%"))
         cmd = "1,$" + cmd.mid(1);
     
-    m_marks['>'] = m_tc.position();
     int beginLine = -1;
     int endLine = -1;
 
-- 
GitLab