forked from qt-creator/qt-creator
Fixes: fakevim: work on 'e', 'w', 'b'...
This commit is contained in:
@@ -480,8 +480,8 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
|
|||||||
m_mode = InsertMode;
|
m_mode = InsertMode;
|
||||||
m_submode = NoSubMode;
|
m_submode = NoSubMode;
|
||||||
} else if (m_submode == DeleteSubMode) {
|
} else if (m_submode == DeleteSubMode) {
|
||||||
//if (m_moveType == MoveExclusive)
|
if (m_moveType == MoveInclusive)
|
||||||
// moveLeft(); // correct
|
moveRight(); // correct
|
||||||
if (!dotCommand.isEmpty())
|
if (!dotCommand.isEmpty())
|
||||||
m_dotCommand = "d" + dotCommand;
|
m_dotCommand = "d" + dotCommand;
|
||||||
m_registers[m_register] = recordRemoveSelectedText();
|
m_registers[m_register] = recordRemoveSelectedText();
|
||||||
@@ -807,9 +807,11 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
|
|||||||
recordBeginGroup();
|
recordBeginGroup();
|
||||||
m_lastInsertion.clear();
|
m_lastInsertion.clear();
|
||||||
} else if (key == 'b') {
|
} else if (key == 'b') {
|
||||||
|
m_moveType = MoveExclusive;
|
||||||
moveToWordBoundary(false, false);
|
moveToWordBoundary(false, false);
|
||||||
finishMovement();
|
finishMovement();
|
||||||
} else if (key == 'B') {
|
} else if (key == 'B') {
|
||||||
|
m_moveType = MoveExclusive;
|
||||||
moveToWordBoundary(true, false);
|
moveToWordBoundary(true, false);
|
||||||
finishMovement();
|
finishMovement();
|
||||||
} else if (key == 'c') {
|
} else if (key == 'c') {
|
||||||
@@ -846,10 +848,11 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
|
|||||||
moveRight(rightDist());
|
moveRight(rightDist());
|
||||||
finishMovement();
|
finishMovement();
|
||||||
} else if (key == 'e') {
|
} else if (key == 'e') {
|
||||||
|
m_moveType = MoveInclusive;
|
||||||
moveToWordBoundary(false, true);
|
moveToWordBoundary(false, true);
|
||||||
m_moveType = MoveExclusive;
|
|
||||||
finishMovement();
|
finishMovement();
|
||||||
} else if (key == 'E') {
|
} else if (key == 'E') {
|
||||||
|
m_moveType = MoveInclusive;
|
||||||
moveToWordBoundary(true, true);
|
moveToWordBoundary(true, true);
|
||||||
finishMovement();
|
finishMovement();
|
||||||
} else if (key == 'f' || key == 'F') {
|
} else if (key == 'f' || key == 'F') {
|
||||||
@@ -1614,8 +1617,7 @@ void FakeVimHandler::Private::moveToWordBoundary(bool simple, bool forward)
|
|||||||
int n = forward ? lastPositionInDocument() - 1 : 0;
|
int n = forward ? lastPositionInDocument() - 1 : 0;
|
||||||
int lastClass = -1;
|
int lastClass = -1;
|
||||||
while (true) {
|
while (true) {
|
||||||
forward ? moveRight() : moveLeft();
|
QChar c = doc->characterAt(m_tc.position() + (forward ? 1 : -1));
|
||||||
QChar c = doc->characterAt(m_tc.position());
|
|
||||||
int thisClass = charClass(c, simple);
|
int thisClass = charClass(c, simple);
|
||||||
if (thisClass != lastClass && lastClass != 0)
|
if (thisClass != lastClass && lastClass != 0)
|
||||||
--repeat;
|
--repeat;
|
||||||
@@ -1624,6 +1626,7 @@ void FakeVimHandler::Private::moveToWordBoundary(bool simple, bool forward)
|
|||||||
lastClass = thisClass;
|
lastClass = thisClass;
|
||||||
if (m_tc.position() == n)
|
if (m_tc.position() == n)
|
||||||
break;
|
break;
|
||||||
|
forward ? moveRight() : moveLeft();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user