aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2010-06-04 12:53:38 +0200
committerhjk <qtc-committer@nokia.com>2010-06-04 13:32:50 +0200
commitaf96a8c901f2e67144fc60631d7286bbf110959f (patch)
tree4f282657d3ddbffc692dc11527d6bda67d02e54c
parenta15608930a42b9fd73bd0c4c1b1ec24d9d075191 (diff)
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. (cherry picked from commit fe396a5146fbdfcbaae3f177d7ce27e94f1f83ae) Reviewed-by: Erik Verbruggen
-rw-r--r--src/plugins/fakevim/fakevimhandler.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index 799e83f42a..37d075e119 100644
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -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);
}