forked from qt-creator/qt-creator
FakeVim: Properly replay macro with command line
Change-Id: I40617a1f6d28052e3593c186afb6db1d14222076 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -3476,6 +3476,25 @@ void FakeVimPlugin::test_macros()
|
|||||||
data.setText(" abc xyz>." N " def xyz>." N " ghi xyz>." N " jkl xyz>.");
|
data.setText(" abc xyz>." N " def xyz>." N " ghi xyz>." N " jkl xyz>.");
|
||||||
KEYS("qq" "^wdf>j" "q", " abc ." N " def " X "xyz>." N " ghi xyz>." N " jkl xyz>.");
|
KEYS("qq" "^wdf>j" "q", " abc ." N " def " X "xyz>." N " ghi xyz>." N " jkl xyz>.");
|
||||||
KEYS("2@q", " abc ." N " def ." N " ghi ." N " jkl " X "xyz>.");
|
KEYS("2@q", " abc ." N " def ." N " ghi ." N " jkl " X "xyz>.");
|
||||||
|
|
||||||
|
// record command line
|
||||||
|
data.setText("abc" N "def");
|
||||||
|
KEYS("qq" ":s/./*/g<ESC>" "iX<ESC>" "q", X "Xabc" N "def");
|
||||||
|
KEYS("@q", X "XXabc" N "def");
|
||||||
|
|
||||||
|
KEYS("qq" ":s/./*/g<BS><BS><BS><BS><BS><BS><BS><BS>" "iY<ESC>" "q", X "YXXabc" N "def");
|
||||||
|
KEYS("@q", X "YYXXabc" N "def");
|
||||||
|
|
||||||
|
KEYS("qq" ":s/./*/g<CR>" "q", X "*******" N "def");
|
||||||
|
KEYS("j@q", "*******" N X "***");
|
||||||
|
|
||||||
|
// record repeating last command
|
||||||
|
data.setText("abc" N "def");
|
||||||
|
KEYS(":s/./-/g<CR>", X "---" N "def");
|
||||||
|
KEYS("u", X "abc" N "def");
|
||||||
|
KEYS("qq" ":<UP><CR>" "q", X "---" N "def");
|
||||||
|
KEYS(":s/./!/g<CR>", X "!!!" N "def");
|
||||||
|
KEYS("j@q", "!!!" N X "!!!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVimPlugin::test_vim_qtcreator()
|
void FakeVimPlugin::test_vim_qtcreator()
|
||||||
|
|||||||
@@ -1856,6 +1856,7 @@ public:
|
|||||||
Q_SLOT void onContentsChanged(int position, int charsRemoved, int charsAdded);
|
Q_SLOT void onContentsChanged(int position, int charsRemoved, int charsAdded);
|
||||||
Q_SLOT void onUndoCommandAdded();
|
Q_SLOT void onUndoCommandAdded();
|
||||||
|
|
||||||
|
bool isCommandLineMode() const { return g.mode == ExMode || g.subsubmode == SearchSubSubMode; }
|
||||||
bool isInsertMode() const { return g.mode == InsertMode || g.mode == ReplaceMode; }
|
bool isInsertMode() const { return g.mode == InsertMode || g.mode == ReplaceMode; }
|
||||||
// Waiting for movement operator.
|
// Waiting for movement operator.
|
||||||
bool isOperatorPending() const {
|
bool isOperatorPending() const {
|
||||||
@@ -2283,7 +2284,7 @@ void FakeVimHandler::Private::focus()
|
|||||||
commitCursor();
|
commitCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool exitCommandLine = (g.subsubmode == SearchSubSubMode || g.mode == ExMode);
|
bool exitCommandLine = isCommandLineMode();
|
||||||
resetCommandMode();
|
resetCommandMode();
|
||||||
if (exitCommandLine)
|
if (exitCommandLine)
|
||||||
updateMiniBuffer();
|
updateMiniBuffer();
|
||||||
@@ -7892,6 +7893,9 @@ void FakeVimHandler::Private::enterVisualInsertMode(QChar command)
|
|||||||
|
|
||||||
void FakeVimHandler::Private::enterCommandMode(Mode returnToMode)
|
void FakeVimHandler::Private::enterCommandMode(Mode returnToMode)
|
||||||
{
|
{
|
||||||
|
if (g.isRecording && isCommandLineMode())
|
||||||
|
record(Input(Key_Escape, NoModifier));
|
||||||
|
|
||||||
if (isNoVisualMode() && atEndOfLine())
|
if (isNoVisualMode() && atEndOfLine())
|
||||||
moveLeft();
|
moveLeft();
|
||||||
g.mode = CommandMode;
|
g.mode = CommandMode;
|
||||||
|
|||||||
Reference in New Issue
Block a user