Commit 893f5bfd authored by Martin Aumüller's avatar Martin Aumüller Committed by hjk
Browse files

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: default avatarhjk <qtc-committer@nokia.com>
parent 2a97605b
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment