Skip to content

Commit

Permalink
clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekazakov committed Dec 27, 2024
1 parent 847271e commit 8c3cc2c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ static constexpr auto make_array_n(T &&value)
{
m_ShortcutsUsage.clear(); // build the map means starting from scratch

for( const auto [tag, default_shortcuts] : m_ShortcutsDefaults ) {
for( const auto &[tag, default_shortcuts] : m_ShortcutsDefaults ) {
if( const auto it = m_ShortcutsOverrides.find(tag); it != m_ShortcutsOverrides.end() ) {
for( const Shortcut &shortcut : it->second ) {
if( shortcut )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ TEST_CASE(PREFIX "Configuration persistence")
}
})";
ConfigImpl config{json, std::make_shared<NonPersistentOverwritesStorage>("")};
ASM manager{config};
const ASM manager{config};
REQUIRE(manager.ShortcutsFromAction("menu.edit.copy") == ASs{});
}
SECTION("Loading from config - single override")
Expand All @@ -213,7 +213,7 @@ TEST_CASE(PREFIX "Configuration persistence")
}
})";
ConfigImpl config{json, std::make_shared<NonPersistentOverwritesStorage>("")};
ASM manager{config};
const ASM manager{config};
REQUIRE(manager.ShortcutsFromAction("menu.edit.copy") == ASs{AS("⌘j")});
}
SECTION("Loading from config - single empty array")
Expand All @@ -224,7 +224,7 @@ TEST_CASE(PREFIX "Configuration persistence")
}
})";
ConfigImpl config{json, std::make_shared<NonPersistentOverwritesStorage>("")};
ASM manager{config};
const ASM manager{config};
REQUIRE(manager.ShortcutsFromAction("menu.edit.copy") == ASs{});
}
SECTION("Loading from config - single array with one shortcut")
Expand All @@ -235,7 +235,7 @@ TEST_CASE(PREFIX "Configuration persistence")
}
})";
ConfigImpl config{json, std::make_shared<NonPersistentOverwritesStorage>("")};
ASM manager{config};
const ASM manager{config};
REQUIRE(manager.ShortcutsFromAction("menu.edit.copy") == ASs{AS("⌘j")});
}
SECTION("Loading from config - single array with two shortcuts")
Expand All @@ -246,7 +246,7 @@ TEST_CASE(PREFIX "Configuration persistence")
}
})";
ConfigImpl config{json, std::make_shared<NonPersistentOverwritesStorage>("")};
ASM manager{config};
const ASM manager{config};
REQUIRE(manager.ShortcutsFromAction("menu.edit.copy") == ASs{AS("⌘j"), AS("⌘k")});
}
SECTION("Loading from config - mixed usage")
Expand All @@ -258,7 +258,7 @@ TEST_CASE(PREFIX "Configuration persistence")
}
})";
ConfigImpl config{json, std::make_shared<NonPersistentOverwritesStorage>("")};
ASM manager{config};
const ASM manager{config};
REQUIRE(manager.ShortcutsFromAction("menu.edit.copy") == ASs{AS("⌘j"), AS("⌘k")});
REQUIRE(manager.ShortcutsFromAction("menu.window.zoom") == ASs{AS("⇧^⌘⌥j")});
}
Expand All @@ -272,7 +272,7 @@ TEST_CASE(PREFIX "Configuration persistence")
"menu.edit.copy": ""
}
})";
ConfigImpl expected_config{expected_json, std::make_shared<NonPersistentOverwritesStorage>("")};
const ConfigImpl expected_config{expected_json, std::make_shared<NonPersistentOverwritesStorage>("")};
REQUIRE(config.Get("hotkeyOverrides_v1") == expected_config.Get("hotkeyOverrides_v1"));
}
SECTION("Writing to config - single override")
Expand All @@ -285,7 +285,7 @@ TEST_CASE(PREFIX "Configuration persistence")
"menu.edit.copy": "⌘j"
}
})";
ConfigImpl expected_config{expected_json, std::make_shared<NonPersistentOverwritesStorage>("")};
const ConfigImpl expected_config{expected_json, std::make_shared<NonPersistentOverwritesStorage>("")};
REQUIRE(config.Get("hotkeyOverrides_v1") == expected_config.Get("hotkeyOverrides_v1"));
}
SECTION("Writing to config - single override with two hotkeys ")
Expand All @@ -298,7 +298,7 @@ TEST_CASE(PREFIX "Configuration persistence")
"menu.edit.copy": ["⌘j", "⌘k"]
}
})";
ConfigImpl expected_config{expected_json, std::make_shared<NonPersistentOverwritesStorage>("")};
const ConfigImpl expected_config{expected_json, std::make_shared<NonPersistentOverwritesStorage>("")};
REQUIRE(config.Get("hotkeyOverrides_v1") == expected_config.Get("hotkeyOverrides_v1"));
}
SECTION("Writing to config - mixed usage")
Expand All @@ -313,7 +313,7 @@ TEST_CASE(PREFIX "Configuration persistence")
"menu.window.zoom": "⇧^⌥⌘j"
}
})";
ConfigImpl expected_config{expected_json, std::make_shared<NonPersistentOverwritesStorage>("")};
const ConfigImpl expected_config{expected_json, std::make_shared<NonPersistentOverwritesStorage>("")};
REQUIRE(config.Get("hotkeyOverrides_v1") == expected_config.Get("hotkeyOverrides_v1"));
}
}
8 changes: 4 additions & 4 deletions Source/Utility/source/ActionShortcut.mm
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@
{
std::string result;
if( modifiers & NSEventModifierFlagShift )
result += reinterpret_cast<const char *>(u8"");
result += "";
if( modifiers & NSEventModifierFlagControl )
result += reinterpret_cast<const char *>(u8"^");
result += "^";
if( modifiers & NSEventModifierFlagOption )
result += reinterpret_cast<const char *>(u8"");
result += "";
if( modifiers & NSEventModifierFlagCommand )
result += reinterpret_cast<const char *>(u8"");
result += "";

if( unicode == '\r' )
result += "\\r";
Expand Down

0 comments on commit 8c3cc2c

Please sign in to comment.