forked from qt-creator/qt-creator
fakevim: fix ^ when it is a dead key
This commit is contained in:
@@ -72,6 +72,7 @@
|
|||||||
#include <QtCore/QStack>
|
#include <QtCore/QStack>
|
||||||
|
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
|
#include <QtGui/QInputMethodEvent>
|
||||||
#include <QtGui/QKeyEvent>
|
#include <QtGui/QKeyEvent>
|
||||||
#include <QtGui/QLineEdit>
|
#include <QtGui/QLineEdit>
|
||||||
#include <QtGui/QPlainTextEdit>
|
#include <QtGui/QPlainTextEdit>
|
||||||
@@ -3968,6 +3969,21 @@ bool FakeVimHandler::eventFilter(QObject *ob, QEvent *ev)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (active && ev->type() == QEvent::InputMethod && ob == d->editor()) {
|
||||||
|
// This handles simple dead keys. The sequence of events is
|
||||||
|
// KeyRelease-InputMethod-KeyRelease for dead keys instead of
|
||||||
|
// KeyPress-KeyRelease as for simple keys. As vi acts on key presses,
|
||||||
|
// we have to act on the InputMethod event.
|
||||||
|
// FIXME: A first approximation working for e.g. ^ on a German keyboard
|
||||||
|
QInputMethodEvent *imev = static_cast<QInputMethodEvent *>(ev);
|
||||||
|
KEY_DEBUG("INPUTMETHOD" << imev->commitString() << imev->preeditString());
|
||||||
|
QString commitString = imev->commitString();
|
||||||
|
int key = commitString.size() == 1 ? commitString.at(0).unicode() : 0;
|
||||||
|
QKeyEvent kev(QEvent::KeyPress, key, Qt::KeyboardModifiers(), commitString);
|
||||||
|
EventResult res = d->handleEvent(&kev);
|
||||||
|
return res == EventHandled;
|
||||||
|
}
|
||||||
|
|
||||||
if (active && ev->type() == QEvent::KeyPress && ob == d->editor()) {
|
if (active && ev->type() == QEvent::KeyPress && ob == d->editor()) {
|
||||||
QKeyEvent *kev = static_cast<QKeyEvent *>(ev);
|
QKeyEvent *kev = static_cast<QKeyEvent *>(ev);
|
||||||
KEY_DEBUG("KEYPRESS" << kev->key());
|
KEY_DEBUG("KEYPRESS" << kev->key());
|
||||||
|
Reference in New Issue
Block a user