forked from qt-creator/qt-creator
fakevim: make sure pending input is only processed once
Change-Id: I0c6141eff49413f66cfee9a1f117279cdfcd4f36 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -1417,7 +1417,7 @@ EventResult FakeVimHandler::Private::handleKey(const Input &input)
|
|||||||
if (m_mode == InsertMode || m_mode == ReplaceMode || m_mode == CommandMode) {
|
if (m_mode == InsertMode || m_mode == ReplaceMode || m_mode == CommandMode) {
|
||||||
g.pendingInput.append(input);
|
g.pendingInput.append(input);
|
||||||
const char code = m_mode == InsertMode ? 'i' : 'n';
|
const char code = m_mode == InsertMode ? 'i' : 'n';
|
||||||
if (g.mappings[code].mappingDone(&g.pendingInput))
|
if (g.mappings.value(code).mappingDone(&g.pendingInput))
|
||||||
return handleKey2();
|
return handleKey2();
|
||||||
if (g.inputTimer != -1)
|
if (g.inputTimer != -1)
|
||||||
killTimer(g.inputTimer);
|
killTimer(g.inputTimer);
|
||||||
@@ -1429,34 +1429,33 @@ EventResult FakeVimHandler::Private::handleKey(const Input &input)
|
|||||||
|
|
||||||
EventResult FakeVimHandler::Private::handleKey2()
|
EventResult FakeVimHandler::Private::handleKey2()
|
||||||
{
|
{
|
||||||
|
Inputs pendingInput = g.pendingInput;
|
||||||
|
g.pendingInput.clear();
|
||||||
if (m_mode == InsertMode) {
|
if (m_mode == InsertMode) {
|
||||||
EventResult result = EventUnhandled;
|
EventResult result = EventUnhandled;
|
||||||
foreach (const Input &in, g.pendingInput) {
|
foreach (const Input &in, pendingInput) {
|
||||||
EventResult r = handleInsertMode(in);
|
EventResult r = handleInsertMode(in);
|
||||||
if (r == EventHandled)
|
if (r == EventHandled)
|
||||||
result = EventHandled;
|
result = EventHandled;
|
||||||
}
|
}
|
||||||
g.pendingInput.clear();
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (m_mode == ReplaceMode) {
|
if (m_mode == ReplaceMode) {
|
||||||
EventResult result = EventUnhandled;
|
EventResult result = EventUnhandled;
|
||||||
foreach (const Input &in, g.pendingInput) {
|
foreach (const Input &in, pendingInput) {
|
||||||
EventResult r = handleReplaceMode(in);
|
EventResult r = handleReplaceMode(in);
|
||||||
if (r == EventHandled)
|
if (r == EventHandled)
|
||||||
result = EventHandled;
|
result = EventHandled;
|
||||||
}
|
}
|
||||||
g.pendingInput.clear();
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (m_mode == CommandMode) {
|
if (m_mode == CommandMode) {
|
||||||
EventResult result = EventUnhandled;
|
EventResult result = EventUnhandled;
|
||||||
foreach (const Input &in, g.pendingInput) {
|
foreach (const Input &in, pendingInput) {
|
||||||
EventResult r = handleCommandMode(in);
|
EventResult r = handleCommandMode(in);
|
||||||
if (r == EventHandled)
|
if (r == EventHandled)
|
||||||
result = EventHandled;
|
result = EventHandled;
|
||||||
}
|
}
|
||||||
g.pendingInput.clear();
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return EventUnhandled;
|
return EventUnhandled;
|
||||||
|
@@ -6117,6 +6117,10 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
QChar c(0x1E9E);
|
||||||
|
bool b = c.isPrint();
|
||||||
|
qDebug() << c << b;
|
||||||
|
|
||||||
// Notify Creator about auto run intention.
|
// Notify Creator about auto run intention.
|
||||||
if (USE_AUTORUN)
|
if (USE_AUTORUN)
|
||||||
qWarning("Creator: Switch on magic autorun.");
|
qWarning("Creator: Switch on magic autorun.");
|
||||||
|
Reference in New Issue
Block a user