From e49ef33a99e5678fd667503b4de7ed25ac2f9364 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Wed, 4 Mar 2009 16:32:33 +0100 Subject: [PATCH] Fixes: fakevim: let Ctrl-K pass to creator core --- src/plugins/fakevim/fakevimhandler.cpp | 19 ++++++++++++++----- tests/manual/gdbdebugger/simple/app.cpp | 3 +-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index c03a072eb1a..d12741c545a 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -1258,8 +1258,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, } } else { qDebug() << "IGNORED IN COMMAND MODE: " << key << text; - if (text.isEmpty()) - handled = false; + handled = false; } return handled; @@ -1414,9 +1413,12 @@ bool FakeVimHandler::Private::handleMiniBufferModes(int key, int unmodified, } else if (key == Key_Tab) { m_commandBuffer += QChar(9); updateMiniBuffer(); - } else { + } else if (QChar(key).isPrint()) { m_commandBuffer += QChar(key); updateMiniBuffer(); + } else { + qDebug() << "IGNORED IN MINIBUFFER MODE: " << key << text; + return false; } return true; } @@ -2182,20 +2184,27 @@ FakeVimHandler::~FakeVimHandler() bool FakeVimHandler::eventFilter(QObject *ob, QEvent *ev) { - if (ev->type() == QEvent::KeyPress && ob == d->editor()) - return d->handleEvent(static_cast<QKeyEvent *>(ev)); + if (ev->type() == QEvent::KeyPress && ob == d->editor()) { + QKeyEvent *kev = static_cast<QKeyEvent *>(ev); + //qDebug() << "KEYPRESS" << kev->key(); + return d->handleEvent(kev); + } if (ev->type() == QEvent::ShortcutOverride && ob == d->editor()) { QKeyEvent *kev = static_cast<QKeyEvent *>(ev); int key = kev->key(); int mods = kev->modifiers(); + //qDebug() << "SHORTCUT OVERRIDE" << key; bool handleIt = (key == Qt::Key_Escape) || (key >= Key_A && key <= Key_Z && mods == Qt::ControlModifier); + //qDebug() << "SHORTCUT HANDLING" << handleIt; if (handleIt && d->handleEvent(kev)) { + //qDebug() << "SHORTCUT HANDLED"; d->enterCommandMode(); ev->accept(); return true; } + //qDebug() << "NOT OVERRIDDEN"; } return QObject::eventFilter(ob, ev); diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp index f4d92fc8233..01617ffa0ce 100644 --- a/tests/manual/gdbdebugger/simple/app.cpp +++ b/tests/manual/gdbdebugger/simple/app.cpp @@ -177,8 +177,7 @@ void testQHash() hgx1["111111111128.0"] = 28.0; hgx1["111111111111111111129.0"] = 29.0; #endif - -#if 1 +if 1 QHash<int, QString> hgg2; hgg2[22] = "22.0"; -- GitLab