Commit d11475ad authored by hjk's avatar hjk
Browse files

Fixes: fakevim

    Details:  fix behaviour of 'r'
parent 9a1dce57
...@@ -105,7 +105,7 @@ enum SubMode ...@@ -105,7 +105,7 @@ enum SubMode
ChangeSubMode, ChangeSubMode,
DeleteSubMode, DeleteSubMode,
FilterSubMode, FilterSubMode,
ReplaceSubMode, ReplaceSubMode, // used for R
YankSubMode, YankSubMode,
IndentSubMode, IndentSubMode,
ZSubMode, ZSubMode,
...@@ -117,7 +117,8 @@ enum SubSubMode ...@@ -117,7 +117,8 @@ enum SubSubMode
FtSubSubMode, // used for f, F, t, T FtSubSubMode, // used for f, F, t, T
MarkSubSubMode, // used for m MarkSubSubMode, // used for m
BackTickSubSubMode, // used for ` BackTickSubSubMode, // used for `
TickSubSubMode // used for ' TickSubSubMode, // used for '
ReplaceSubSubMode // used for r
}; };
enum VisualMode enum VisualMode
...@@ -301,7 +302,6 @@ public: ...@@ -301,7 +302,6 @@ public:
QStack<int> m_undoGroupStack; QStack<int> m_undoGroupStack;
// extra data for '.' // extra data for '.'
QString m_dotCount;
QString m_dotCommand; QString m_dotCommand;
// history for '/' // history for '/'
...@@ -468,6 +468,7 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand) ...@@ -468,6 +468,7 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
m_submode = NoSubMode; m_submode = NoSubMode;
} else if (m_moveType == MoveExclusive) { } else if (m_moveType == MoveExclusive) {
moveLeft(); // correct moveLeft(); // correct
m_moveType = MoveInclusive;
} }
m_mvcount.clear(); m_mvcount.clear();
m_opcount.clear(); m_opcount.clear();
...@@ -655,6 +656,22 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, ...@@ -655,6 +656,22 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
handleFfTt(key); handleFfTt(key);
m_subsubmode = NoSubSubMode; m_subsubmode = NoSubSubMode;
finishMovement(QString(QChar(m_subsubdata)) + QChar(key)); finishMovement(QString(QChar(m_subsubdata)) + QChar(key));
} else if (m_subsubmode == ReplaceSubSubMode) {
if (count() < rightDist() && text.size() == 1
&& (text.at(0).isPrint() || text.at(0).isSpace())) {
recordBeginGroup();
setAnchor();
moveRight(count());
recordRemoveSelectedText();
recordInsertText(QString(count(), text.at(0)));
recordEndGroup();
m_moveType = MoveExclusive;
m_subsubmode = NoSubSubMode;
m_dotCommand = QString("%1r%2").arg(count()).arg(text);
finishMovement();
} else {
m_subsubmode = NoSubSubMode;
}
} else if (m_subsubmode == MarkSubSubMode) { } else if (m_subsubmode == MarkSubSubMode) {
m_marks[key] = m_tc.position(); m_marks[key] = m_tc.position();
m_subsubmode = NoSubSubMode; m_subsubmode = NoSubSubMode;
...@@ -930,8 +947,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, ...@@ -930,8 +947,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
recordEndGroup(); recordEndGroup();
m_dotCommand = "p"; m_dotCommand = "p";
} else if (key == 'r') { } else if (key == 'r') {
recordBeginGroup(); m_subsubmode = ReplaceSubSubMode;
m_submode = ReplaceSubMode;
m_dotCommand = "r"; m_dotCommand = "r";
} else if (key == 'R') { } else if (key == 'R') {
recordBeginGroup(); recordBeginGroup();
......
Supports Markdown
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