FakeVim: Correct key mappings with Qt 5

Task-number: QTCREATORBUG-8774
Change-Id: I4b7e90a99e9ff2f56f14f28636fe32fe39b4d4b8
Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
Lukas Holecek
2013-02-23 11:02:43 +01:00
committed by hjk
parent d58415ed3e
commit 8d295948e0

View File

@@ -833,12 +833,18 @@ public:
Input(int k, int m, const QString &t = QString()) Input(int k, int m, const QString &t = QString())
: m_key(k), m_modifiers(cleanModifier(m)), m_text(t) : m_key(k), m_modifiers(cleanModifier(m)), m_text(t)
{ {
// On Mac, QKeyEvent::text() returns non-empty strings for if (m_text.size() == 1) {
// cursor keys. This breaks some of the logic later on QChar x = m_text.at(0);
// relying on text() being empty for "special" keys.
// FIXME: Check the real conditions. // On Mac, QKeyEvent::text() returns non-empty strings for
if (m_text.size() == 1 && m_text.at(0).unicode() < ' ') // cursor keys. This breaks some of the logic later on
m_text.clear(); // relying on text() being empty for "special" keys.
// FIXME: Check the real conditions.
if (x.unicode() < ' ')
m_text.clear();
else
m_key = x.toUpper().unicode();
}
// Set text only if input is ascii key without control modifier. // Set text only if input is ascii key without control modifier.
if (m_text.isEmpty() && k <= 0x7f && (m & (HostOsInfo::controlModifier())) == 0) { if (m_text.isEmpty() && k <= 0x7f && (m & (HostOsInfo::controlModifier())) == 0) {