Skip to content

Commit

Permalink
Update accelerator text generation for Ctrl+-/Ctrl++
Browse files Browse the repository at this point in the history
This is part of the work for issue #476.
  • Loading branch information
derceg committed Sep 6, 2024
1 parent c6ddf55 commit 239fb87
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Explorer++/Helper/Helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,9 @@ bool IsExtendedKey(UINT key)
|| key == VK_INSERT
|| key == VK_DELETE
|| key == VK_DIVIDE
|| key == VK_NUMLOCK)
|| key == VK_NUMLOCK
|| key == VK_ADD
|| key == VK_SUBTRACT)
// clang-format on
{
return true;
Expand Down
14 changes: 14 additions & 0 deletions Explorer++/TestExplorer++/AcceleratorHelperTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ TEST(AcceleratorHelperTest, BuildAcceleratorString)
accelerator.key = 'P';
acceleratorText = BuildAcceleratorString(accelerator);
EXPECT_EQ(acceleratorText, L"Ctrl+Shift+P");

// This should generate the string "Ctrl++" (and not something like "Ctrl+Num +").
accelerator = {};
accelerator.fVirt = FVIRTKEY | FCONTROL;
accelerator.key = VK_ADD;
acceleratorText = BuildAcceleratorString(accelerator);
EXPECT_EQ(acceleratorText, L"Ctrl++");

// And this should be "Ctrl+-" (not "Ctrl+Num -").
accelerator = {};
accelerator.fVirt = FVIRTKEY | FCONTROL;
accelerator.key = VK_SUBTRACT;
acceleratorText = BuildAcceleratorString(accelerator);
EXPECT_EQ(acceleratorText, L"Ctrl+-");
}

TEST(AcceleratorHelperTest, AcceleratorTableConversion)
Expand Down

0 comments on commit 239fb87

Please sign in to comment.