mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-07 22:05:32 +00:00
Exclude letter hotkeys from Shift fallback
There is a fallback mechanism here designed to catch cases where a hotkey is bound to a key that needs Shift to be input (e.g. ? requires Shift on many non-US keyboards, but the hotkey for that should be '?', not 'Shift+/'). For any key where the two options are equally-valid "main" key (e.g. '6' and '^' or '?' and '/' or ':' amd ';'), this is correct, as it allows the hotkey to be simply the character in question. Letters don't require this treatment - using this fallback in the letter case means that a hotkey bound to 'B' will also fire when 'Shift+B' is pressed, even when Shift+B is bound to something else. In fact, it could even preempt the real Shift+B hotkey. Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19093
This commit is contained in:
parent
5885ba7b51
commit
03f11eea78
@ -48,7 +48,7 @@ ACTION_MANAGER::ACTION_MANAGER( TOOL_MANAGER* aToolManager ) :
|
||||
std::string groupName = "none";
|
||||
|
||||
std::optional<TOOL_ACTION_GROUP> group = action->GetActionGroup();
|
||||
|
||||
|
||||
if( group.has_value() )
|
||||
{
|
||||
groupID = group.value().GetGroupID();
|
||||
@ -152,19 +152,21 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
|
||||
// If no luck, try without Shift, to handle keys that require it
|
||||
// e.g. to get ? you need to press Shift+/ without US keyboard layout
|
||||
// Hardcoding ? as Shift+/ is a bad idea, as on another layout you may need to press a
|
||||
// different combination
|
||||
if( it == m_actionHotKeys.end() )
|
||||
// different combination.
|
||||
// This doesn't apply for letters, as we already handled case normalisation.
|
||||
if( it == m_actionHotKeys.end() && !std::isalpha( key ) )
|
||||
{
|
||||
wxLogTrace( kicadTraceToolStack,
|
||||
wxS( "ACTION_MANAGER::RunHotKey No actions found, searching with key: %s" ),
|
||||
KeyNameFromKeyCode( key | ( mod & ~MD_SHIFT ) ) );
|
||||
|
||||
it = m_actionHotKeys.find( key | ( mod & ~MD_SHIFT ) );
|
||||
|
||||
if( it == m_actionHotKeys.end() )
|
||||
return false; // no appropriate action found for the hotkey
|
||||
}
|
||||
|
||||
// Still no luck, we're done without a match
|
||||
if( it == m_actionHotKeys.end() )
|
||||
return false; // no appropriate action found for the hotkey
|
||||
|
||||
const std::list<TOOL_ACTION*>& actions = it->second;
|
||||
|
||||
// Choose the action that has the highest priority on the active tools stack
|
||||
|
Loading…
Reference in New Issue
Block a user