forked from qt-creator/qt-creator
FakeVim: Check if input is [count] for a command properly
Change-Id: I831b87733ca96a31cd9da10375d10998a1722c12 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -1434,6 +1434,7 @@ public:
|
|||||||
void stopIncrementalFind();
|
void stopIncrementalFind();
|
||||||
void updateFind(bool isComplete);
|
void updateFind(bool isComplete);
|
||||||
|
|
||||||
|
bool isInputCount(const Input &) const; // Return true if input can be used as count for commands.
|
||||||
int mvCount() const { return m_mvcount.isEmpty() ? 1 : m_mvcount.toInt(); }
|
int mvCount() const { return m_mvcount.isEmpty() ? 1 : m_mvcount.toInt(); }
|
||||||
int opCount() const { return m_opcount.isEmpty() ? 1 : m_opcount.toInt(); }
|
int opCount() const { return m_opcount.isEmpty() ? 1 : m_opcount.toInt(); }
|
||||||
int count() const { return mvCount() * opCount(); }
|
int count() const { return mvCount() * opCount(); }
|
||||||
@@ -2449,6 +2450,11 @@ void FakeVimHandler::Private::updateFind(bool isComplete)
|
|||||||
search(sd, isComplete);
|
search(sd, isComplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FakeVimHandler::Private::isInputCount(const Input &input) const
|
||||||
|
{
|
||||||
|
return input.isDigit() && (!input.is('0') || !m_mvcount.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
bool FakeVimHandler::Private::atEmptyLine(const QTextCursor &tc) const
|
bool FakeVimHandler::Private::atEmptyLine(const QTextCursor &tc) const
|
||||||
{
|
{
|
||||||
if (tc.isNull())
|
if (tc.isNull())
|
||||||
@@ -3040,7 +3046,7 @@ bool FakeVimHandler::Private::handleCommandSubSubMode(const Input &input)
|
|||||||
|
|
||||||
bool FakeVimHandler::Private::handleCount(const Input &input)
|
bool FakeVimHandler::Private::handleCount(const Input &input)
|
||||||
{
|
{
|
||||||
if (!input.isDigit() || (input.is('0') && m_mvcount.isEmpty()))
|
if (!isInputCount(input))
|
||||||
return false;
|
return false;
|
||||||
m_mvcount.append(input.text());
|
m_mvcount.append(input.text());
|
||||||
return true;
|
return true;
|
||||||
@@ -3350,7 +3356,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(const Input &input)
|
|||||||
|
|
||||||
bool clearGflag = m_gflag;
|
bool clearGflag = m_gflag;
|
||||||
bool clearRegister = m_submode != RegisterSubMode;
|
bool clearRegister = m_submode != RegisterSubMode;
|
||||||
bool clearCount = m_submode != RegisterSubMode && !input.isDigit();
|
bool clearCount = m_submode != RegisterSubMode && !isInputCount(input);
|
||||||
|
|
||||||
// Process input for a sub-mode.
|
// Process input for a sub-mode.
|
||||||
if (input.isEscape()) {
|
if (input.isEscape()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user