From 50cf2a7a0644c7b2dbc7cb7a0c3bee83ebcaf7f8 Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Sun, 28 Dec 2008 02:32:44 +0100
Subject: [PATCH] basic implementation of 'o'

---
 src/plugins/fakevim/handler.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/plugins/fakevim/handler.cpp b/src/plugins/fakevim/handler.cpp
index 9807f867132..22f78b44bbf 100644
--- a/src/plugins/fakevim/handler.cpp
+++ b/src/plugins/fakevim/handler.cpp
@@ -68,6 +68,7 @@ using namespace FakeVim::Internal;
 ///////////////////////////////////////////////////////////////////////
 
 #define EDITOR(s) (m_textedit ? m_textedit->s : m_plaintextedit->s)
+#define THE_EDITOR (m_textedit ? (QWidget*)m_textedit : (QWidget*)m_plaintextedit)
 
 const int ParagraphSeparator = 0x00002029;
 
@@ -482,6 +483,12 @@ void FakeVimHandler::Private::handleCommandMode(int key, const QString &text)
         search(lastSearchString(), m_lastSearchForward);
     } else if (key == 'N') {
         search(lastSearchString(), !m_lastSearchForward);
+    } else if (key == 'o') {
+        m_mode = InsertMode;
+        m_lastInsertion.clear();
+        //m_tc.beginEditBlock();  // FIXME: unusable due to drawing errors
+        m_tc.movePosition(EndOfLine, MoveAnchor);
+        m_tc.insertText("\n");
     } else if (key == 'p') {
         QString text = m_registers[m_register];
         int n = text.count(QChar(ParagraphSeparator));
@@ -732,10 +739,7 @@ void FakeVimHandler::Private::handleCommand(const QString &cmd0)
             ->findBlockByNumber(beginLine - 1).position());
         showMessage(QString());
     } else if (cmd == "q!" || cmd == "q") {
-        if (m_textedit)
-            q->quitRequested(m_textedit);
-        else
-            q->quitRequested(m_plaintextedit);
+        q->quitRequested(THE_EDITOR);
         showMessage(QString());
     } else if (reWrite.indexIn(cmd) != -1) {
         bool forced = cmd.startsWith("w!");
-- 
GitLab