fakevim: only overwrite m_tc with EDITOR's cursor if necessary

only ex commands that are handled externally might modify the cursor position w/o updating m_tc

Merge-request: 113
Reviewed-by: hjk <qtc-committer@nokia.com>
This commit is contained in:
Martin Aumüller
2010-02-19 13:01:39 +01:00
committed by hjk
parent 7a71ee1166
commit 5af95f01f0

View File

@@ -2132,15 +2132,10 @@ EventResult FakeVimHandler::Private::handleMiniBufferModes(int key, int unmodifi
if (!m_commandBuffer.isEmpty()) {
m_commandHistory.takeLast();
m_commandHistory.append(m_commandBuffer);
// FIXME: This was inserted to prevent crashes when the
// editor 'vanishes' but broke things like :<line>.
// How can the crash be reproduced?
// when EDITOR(setTextCursor(m_tc));
handleExCommand(m_commandBuffer);
//if (m_textedit || m_plaintextedit) {
// m_tc = EDITOR(textCursor());
leaveVisualMode();
//}
if (m_textedit || m_plaintextedit) {
leaveVisualMode();
}
}
} else if (unmodified == Key_Return && isSearchMode()) {
if (!m_commandBuffer.isEmpty()) {
@@ -2559,7 +2554,10 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
void FakeVimHandler::Private::passUnknownExCommand(const QString &cmd)
{
EDITOR(setTextCursor(m_tc));
emit q->handleExCommandRequested(cmd);
if (m_plaintextedit || m_textedit)
m_tc = EDITOR(textCursor());
}
void FakeVimHandler::Private::passUnknownSetCommand(const QString &arg)