fakevim: don't swap cmd and ctrl keys on os x

qt reversed the mapping of cmd and ctrl internally, this should be re-reversed in vi

Merge-request: 190
Reviewed-by: hjk <qtc-committer@nokia.com>
This commit is contained in:
Martin Aumüller
2010-10-26 10:56:32 +02:00
committed by hjk
parent 2a97605b24
commit 893f5bfd23

View File

@@ -405,8 +405,13 @@ public:
bool isControl(int c) const
{
return m_modifiers == Qt::ControlModifier &&
(m_xkey == c || m_xkey + 32 == c || m_xkey + 64 == c || m_xkey + 96 == c);
return m_modifiers ==
#ifdef Q_WS_MAC
Qt::MetaModifier
#else
Qt::ControlModifier
#endif
&& (m_xkey == c || m_xkey + 32 == c || m_xkey + 64 == c || m_xkey + 96 == c);
}
bool isShift(int c) const
@@ -1026,7 +1031,12 @@ bool FakeVimHandler::Private::wantsOverride(QKeyEvent *ev)
}
// We are interested in overriding most Ctrl key combinations
if (mods == Qt::ControlModifier
if (mods ==
#ifdef Q_WS_MAC
Qt::MetaModifier
#else
Qt::ControlModifier
#endif
&& !config(ConfigPassControlKey).toBool()
&& ((key >= Key_A && key <= Key_Z && key != Key_K)
|| key == Key_BracketLeft || key == Key_BracketRight)) {
@@ -1220,7 +1230,13 @@ void FakeVimHandler::Private::importSelection()
// Import new selection.
Qt::KeyboardModifiers mods = QApplication::keyboardModifiers();
if (cursor().hasSelection()) {
if (mods & Qt::ControlModifier)
if (mods &
#ifdef Q_WS_MAC
Qt::MetaModifier
#else
Qt::ControlModifier
#endif
)
m_visualMode = VisualBlockMode;
else if (mods & Qt::AltModifier)
m_visualMode = VisualBlockMode;