fakevim: fix cursor keys on Mac.

On Mac, QKeyEvent::text() returns non-empty strings for cursor keys. This
breaks some of the logic relying on text() being empty for "special" keys.

This is a quick fix to make it usable.
This commit is contained in:
hjk
2010-06-04 12:53:38 +02:00
parent b17cd1fd85
commit fe396a5146

View File

@@ -351,6 +351,12 @@ public:
Input(int k, int m, const QString &t)
: m_key(k), m_modifiers(m), m_text(t)
{
// On Mac, QKeyEvent::text() returns non-empty strings for
// cursor keys. This breaks some of the logic later on
// relying on text() being empty for "special" keys.
// FIXME: Check the real conditions.
if (m_text.size() == 1 && m_text.at(0).unicode() < ' ')
m_text.clear();
// m_xkey is only a cache.
m_xkey = (m_text.size() == 1 ? m_text.at(0).unicode() : m_key);
}