Commit 81ff5cda authored by hjk's avatar hjk
Browse files

fakevim: fix QTCREATORBUG-880

parent 284b8d38
...@@ -591,9 +591,8 @@ bool FakeVimHandler::Private::wantsOverride(QKeyEvent *ev) ...@@ -591,9 +591,8 @@ bool FakeVimHandler::Private::wantsOverride(QKeyEvent *ev)
if (key == Key_Escape || (mods == Qt::ControlModifier && key == Key_BracketLeft)) { if (key == Key_Escape || (mods == Qt::ControlModifier && key == Key_BracketLeft)) {
// Not sure this feels good. People often hit Esc several times // Not sure this feels good. People often hit Esc several times
if (isNoVisualMode() && m_mode == CommandMode) //return !isNoVisualMode() || m_mode != CommandMode;
return false; return !m_passing;
return true;
} }
// We are interested in overriding most Ctrl key combinations // We are interested in overriding most Ctrl key combinations
...@@ -772,9 +771,7 @@ void FakeVimHandler::Private::restoreWidget() ...@@ -772,9 +771,7 @@ void FakeVimHandler::Private::restoreWidget()
EventResult FakeVimHandler::Private::handleKey(int key, int unmodified, EventResult FakeVimHandler::Private::handleKey(int key, int unmodified,
const QString &text) const QString &text)
{ {
//qDebug() << " CURSOR POS: " << m_undoCursorPosition;
setUndoPosition(m_tc.position()); setUndoPosition(m_tc.position());
//qDebug() << "KEY: " << key << text << "POS: " << m_tc.position();
if (m_mode == InsertMode) if (m_mode == InsertMode)
return handleInsertMode(key, unmodified, text); return handleInsertMode(key, unmodified, text);
if (m_mode == CommandMode) if (m_mode == CommandMode)
...@@ -1287,11 +1284,11 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified, ...@@ -1287,11 +1284,11 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
} else { } else {
m_mvcount.append(QChar(key)); m_mvcount.append(QChar(key));
} }
} else if (key == '^') { } else if (key == '^' || key == '_') {
moveToFirstNonBlankOnLine(); moveToFirstNonBlankOnLine();
setTargetColumn(); setTargetColumn();
m_movetype = MoveExclusive; m_movetype = MoveExclusive;
finishMovement(QString(QLatin1Char('^'))); finishMovement(QString(QLatin1Char(key)));
} else if (0 && key == ',') { } else if (0 && key == ',') {
// FIXME: fakevim uses ',' by itself, so it is incompatible // FIXME: fakevim uses ',' by itself, so it is incompatible
m_subsubmode = FtSubSubMode; m_subsubmode = FtSubSubMode;
...@@ -1927,7 +1924,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified, ...@@ -1927,7 +1924,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
removeSelectedText(); removeSelectedText();
} else if (key == Key_BracketLeft || key == Key_BracketRight) { } else if (key == Key_BracketLeft || key == Key_BracketRight) {
} else if (key == Key_Escape) { } else if (key == Key_Escape || key == 379 /* ^[ */) {
if (isVisualMode()) { if (isVisualMode()) {
leaveVisualMode(); leaveVisualMode();
} else if (m_submode != NoSubMode) { } else if (m_submode != NoSubMode) {
...@@ -2129,7 +2126,7 @@ EventResult FakeVimHandler::Private::handleMiniBufferModes(int key, int unmodifi ...@@ -2129,7 +2126,7 @@ EventResult FakeVimHandler::Private::handleMiniBufferModes(int key, int unmodifi
{ {
Q_UNUSED(text) Q_UNUSED(text)
if (key == Key_Escape || key == control('c')) { if (key == Key_Escape || key == 379 /* ^[ */ || key == control('c')) {
m_commandBuffer.clear(); m_commandBuffer.clear();
enterCommandMode(); enterCommandMode();
updateMiniBuffer(); updateMiniBuffer();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment