Remove duplicate entries in command palette (SpartanJ/ecode#680).

This commit is contained in:
Martín Lucas Golini
2025-09-30 01:26:28 -03:00
parent 3248543ce2
commit 3ca72f91d3

View File

@@ -7,6 +7,9 @@ CommandPalette::build( const std::vector<std::string>& commandList,
const EE::UI::KeyBindings& keybindings ) {
std::vector<std::vector<std::string>> ret;
for ( const auto& cmd : commandList ) {
if ( std::find_if( ret.begin(), ret.end(),
[&cmd]( const auto& other ) { return other[2] == cmd; } ) != ret.end() )
continue;
std::string cmdName( cmd );
String::capitalizeInPlace( cmdName );
String::replaceAll( cmdName, "-", " " );