forked from qt-creator/qt-creator
FakeVim: Fix control modifier test
* Fix logic * Rename the function Change-Id: Ifa0bb77693e17ee75f30646ea3bbbf858e6e391c Reviewed-by: Lukas Holecek <hluk@email.cz> Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -784,10 +784,9 @@ static const QMap<QString, int> &vimKeyNames()
|
|||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isControlModifier(const Qt::KeyboardModifiers &mods)
|
static bool isOnlyControlModifier(const Qt::KeyboardModifiers &mods)
|
||||||
{
|
{
|
||||||
static const int ctrl = HostOsInfo::controlModifier();
|
return (mods ^ HostOsInfo::controlModifier()) == Qt::NoModifier;
|
||||||
return (mods & ctrl) == ctrl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -949,7 +948,7 @@ public:
|
|||||||
|
|
||||||
bool isControl() const
|
bool isControl() const
|
||||||
{
|
{
|
||||||
return isControlModifier(m_modifiers);
|
return isOnlyControlModifier(m_modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isControl(int c) const
|
bool isControl(int c) const
|
||||||
@@ -2221,7 +2220,7 @@ bool FakeVimHandler::Private::wantsOverride(QKeyEvent *ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We are interested in overriding most Ctrl key combinations.
|
// We are interested in overriding most Ctrl key combinations.
|
||||||
if (isControlModifier(mods)
|
if (isOnlyControlModifier(mods)
|
||||||
&& !config(ConfigPassControlKey).toBool()
|
&& !config(ConfigPassControlKey).toBool()
|
||||||
&& ((key >= Key_A && key <= Key_Z && key != Key_K)
|
&& ((key >= Key_A && key <= Key_Z && key != Key_K)
|
||||||
|| key == Key_BracketLeft || key == Key_BracketRight)) {
|
|| key == Key_BracketLeft || key == Key_BracketRight)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user