Skip to content

Commit

Permalink
Modify caps lock behaviour of shift method
Browse files Browse the repository at this point in the history
We really shouldn't be merging these two checks. Shift behaviour is independent of Caps Locks for most control key combinations. For typing and capitalization, it should be XOR of Shift and Caps, not the OR of them.
  • Loading branch information
DanRStevens committed Jan 28, 2024
1 parent 629aaed commit 43bb9d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion NAS2D/EventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ bool EventHandler::textInputMode()
*/
bool EventHandler::shift(KeyModifier mod)
{
return KeyModifier::None != (mod & (KeyModifier::Shift | KeyModifier::Caps));
return KeyModifier::None != (mod & (KeyModifier::Shift));
}


Expand Down
2 changes: 1 addition & 1 deletion test/EventHandler.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ TEST(EventHandler, shift) {
EXPECT_TRUE(NAS2D::EventHandler::shift(NAS2D::EventHandler::KeyModifier::ShiftLeft));
EXPECT_TRUE(NAS2D::EventHandler::shift(NAS2D::EventHandler::KeyModifier::ShiftRight));
EXPECT_TRUE(NAS2D::EventHandler::shift(NAS2D::EventHandler::KeyModifier::ShiftLeft | NAS2D::EventHandler::KeyModifier::CtrlLeft));
EXPECT_TRUE(NAS2D::EventHandler::shift(NAS2D::EventHandler::KeyModifier::Caps));
EXPECT_FALSE(NAS2D::EventHandler::shift(NAS2D::EventHandler::KeyModifier::Caps));
EXPECT_FALSE(NAS2D::EventHandler::shift(NAS2D::EventHandler::KeyModifier::Ctrl));
EXPECT_FALSE(NAS2D::EventHandler::shift(NAS2D::EventHandler::KeyModifier::Alt));
}
Expand Down

0 comments on commit 43bb9d4

Please sign in to comment.