fakevim: v in visual mode actually leave visual mode

Task-number: QTCREATORBUG-5603
Change-Id: I239837b1d8ad30fdc157a6eaec05a026c294a750
(cherry picked from commit 764f902cf3)
Reviewed-on: http://codereview.qt.nokia.com/2578
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
hjk
2011-08-02 17:59:05 +02:00
committed by Eike Ziller
parent 86e6cc6728
commit 1a0056eea9

View File

@@ -906,8 +906,8 @@ public:
Input m_semicolonType; // 'f', 'F', 't', 'T'
QString m_semicolonKey;
// visual line mode
void enterVisualMode(VisualMode visualMode);
// visual modes
void toggleVisualMode(VisualMode visualMode);
void leaveVisualMode();
VisualMode m_visualMode;
VisualMode m_oldVisualMode;
@@ -2520,11 +2520,11 @@ EventResult FakeVimHandler::Private::handleCommandMode2(const Input &input)
scrollToLine(cursorLine() - sline);
finishMovement();
} else if (input.is('v')) {
enterVisualMode(VisualCharMode);
toggleVisualMode(VisualCharMode);
} else if (input.is('V')) {
enterVisualMode(VisualLineMode);
toggleVisualMode(VisualLineMode);
} else if (input.isControl('v')) {
enterVisualMode(VisualBlockMode);
toggleVisualMode(VisualBlockMode);
} else if (input.is('w')) { // tested
// Special case: "cw" and "cW" work the same as "ce" and "cE" if the
// cursor is on a non-blank - except if the cursor is on the last
@@ -4614,17 +4614,21 @@ int FakeVimHandler::Private::lineForPosition(int pos) const
return tc.block().blockNumber() + 1;
}
void FakeVimHandler::Private::enterVisualMode(VisualMode visualMode)
void FakeVimHandler::Private::toggleVisualMode(VisualMode visualMode)
{
m_positionPastEnd = false;
m_anchorPastEnd = false;
m_visualMode = visualMode;
const int pos = position();
//setMark('<', pos);
//setMark('>', pos + 1);
setAnchorAndPosition(pos, pos);
updateMiniBuffer();
updateSelection();
if (isVisualMode()) {
leaveVisualMode();
} else {
m_positionPastEnd = false;
m_anchorPastEnd = false;
m_visualMode = visualMode;
const int pos = position();
//setMark('<', pos);
//setMark('>', pos + 1);
setAnchorAndPosition(pos, pos);
updateMiniBuffer();
updateSelection();
}
}
void FakeVimHandler::Private::leaveVisualMode()