From 0b3b398800262983349877470dba652a8347fbbb Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Mon, 10 May 2010 09:48:12 +0200 Subject: [PATCH] fakevim: try to "export" also block selections. --- src/plugins/fakevim/fakevimhandler.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index a238e8d80c0..ecb09e7b1c0 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -1011,11 +1011,13 @@ void FakeVimHandler::Private::importSelection() QTextCursor tc = EDITOR(textCursor()); int pos = tc.position(); int anc = tc.anchor(); - // FIXME: Why? - if (pos < anc) - --anc; - else - tc.movePosition(Left, KeepAnchor); + if (tc.hasSelection()) { + // FIXME: Why? + if (pos < anc) + --anc; + else + tc.movePosition(Left, KeepAnchor); + } m_marks['<'] = anc; m_marks['>'] = pos; m_anchor = anc; @@ -1060,7 +1062,7 @@ void FakeVimHandler::Private::restoreWidget(int tabSize) m_tc.setPosition(firstPositionInLine(beginLine), MoveAnchor); m_tc.setPosition(lastPositionInLine(endLine), KeepAnchor); EDITOR(setTextCursor(m_tc)); - } else if (isVisualCharMode()) { + } else if (isVisualCharMode() || isVisualBlockMode()) { m_tc = EDITOR(textCursor()); m_tc.setPosition(m_marks['<'], MoveAnchor); m_tc.setPosition(m_marks['>'], KeepAnchor); -- GitLab