From bc73e14e68f43943b1ba190389ba35f78d7e6566 Mon Sep 17 00:00:00 2001 From: Yifan Zhu Date: Fri, 15 Dec 2023 23:39:09 -0800 Subject: [PATCH] tabbox: match Shift+Backtab against Shift+Tab When users simultaneously press Shift and Tab, the keys are sometimes registered as Shift+Tab, and sometimes as Shift+Backtab. So we need to match received Shift+Tab against shortcuts containing Shift+Backtab, and vice versa. Previously the code only checks for the first case. This commit adds checks for the second case. BUG: 438991 FIXED-IN: 6.0 --- src/tabbox/tabbox.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/tabbox/tabbox.cpp b/src/tabbox/tabbox.cpp index 6794bbaec8..6263a5ffbf 100644 --- a/src/tabbox/tabbox.cpp +++ b/src/tabbox/tabbox.cpp @@ -998,15 +998,16 @@ void TabBox::keyPress(int keyQt) return Steady; } - // Before testing the unshifted key (Ctrl+A vs. Ctrl+Shift+a etc.), see whether this is +Shift+Tab - // and check that against +Shift+Backtab (as well) + // Before testing the unshifted key (Ctrl+A vs. Ctrl+Shift+a etc.), + // see whether this is +Shift+Tab/Backtab and test that against + // +Shift+Backtab/Tab as well Qt::KeyboardModifiers mods = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier | Qt::GroupSwitchModifier; mods &= keyQt; - if ((keyQt & ~mods) == Qt::Key_Tab) { - if (contains(forward, mods | Qt::Key_Backtab)) { + if (((keyQt & ~mods) == Qt::Key_Tab) || ((keyQt & ~mods) == Qt::Key_Backtab)) { + if (contains(forward, mods | Qt::Key_Backtab) || contains(forward, mods | Qt::Key_Tab)) { return Forward; } - if (contains(backward, mods | Qt::Key_Backtab)) { + if (contains(backward, mods | Qt::Key_Backtab) || contains(backward, mods | Qt::Key_Tab)) { return Backward; } }