From 275d429eaca648f592a5daea2f4154faaa895094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Aum=C3=BCller?= <aumuell@reserv.at> Date: Thu, 18 Mar 2010 13:15:59 +0100 Subject: [PATCH] fakevim: use handleExCommand instead of handleCommand handleCommand does not work correctly for commands that move the cursor (the cursor movement would get overwritten immediately) Merge-request: 131 Reviewed-by: hjk <qtc-committer@nokia.com> --- src/plugins/fakevim/fakevimhandler.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index d3b904cf238..de1a530b1a2 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -1246,9 +1246,9 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified, // Recognize ZZ and ZQ as aliases for ":x" and ":q!". m_submode = NoSubMode; if (key == 'Z') - handleCommand(QString(QLatin1Char('x'))); + handleExCommand(QString(QLatin1Char('x'))); else if (key == 'Q') - handleCommand("q!"); + handleExCommand("q!"); } else if (m_submode == ReplaceSubMode) { if (count() <= (rightDist() + atEndOfLine()) && text.size() == 1 && (text.at(0).isPrint() || text.at(0).isSpace())) { @@ -1760,20 +1760,20 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified, finishMovement(); } else if (m_gflag && key == 't') { m_gflag = false; - handleCommand("tabnext"); + handleExCommand("tabnext"); } else if (key == 't') { m_movetype = MoveInclusive; m_subsubmode = FtSubSubMode; m_subsubdata = key; } else if (m_gflag && key == 'T') { m_gflag = false; - handleCommand("tabprev"); + handleExCommand("tabprev"); } else if (key == 'T') { m_movetype = MoveExclusive; m_subsubmode = FtSubSubMode; m_subsubdata = key; } else if (key == control('t')) { - handleCommand("pop"); + handleExCommand("pop"); } else if (!m_gflag && key == 'u') { undo(); } else if (key == control('u')) { @@ -1931,7 +1931,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified, } else if (key == Key_BracketLeft || key == Key_BracketRight) { } else if (key == control(Key_BracketRight)) { - handleCommand("tag"); + handleExCommand("tag"); } else if (key == Key_Escape || key == control(Key_BracketLeft)) { if (isVisualMode()) { leaveVisualMode(); @@ -2277,6 +2277,7 @@ void FakeVimHandler::Private::selectRange(int beginLine, int endLine) setPosition(firstPositionInLine(endLine + 1)); } +// use handleExCommand for invoking commands that might move the cursor void FakeVimHandler::Private::handleCommand(const QString &cmd) { m_tc = EDITOR(textCursor()); -- GitLab