From 53f861bdd410018380a0ac78a764a0bda0b33f42 Mon Sep 17 00:00:00 2001 From: "Devin J. Pohly" Date: Fri, 30 Aug 2013 14:09:03 -0400 Subject: [PATCH] fix duplicate removal in editor help The sort was in place for this purpose. Let's use it on the modifier keys, but not sort the regular keys, since the order matters for those. This isn't really the right way to do this from the start, but that'll be something that could be rewritten at another time given that our mappings are still pretty much hardcoded. --- src/ScreenEdit.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index f08f1232ad..39a506163a 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -5757,11 +5757,13 @@ static void ProcessKeyName( RString &s ) s.Replace( "Key_", "" ); } -static void ProcessKeyNames( vector &vs ) +static void ProcessKeyNames( vector &vs, bool doSort ) { FOREACH( RString, vs, s ) ProcessKeyName( *s ); + if (doSort) + sort( vs.begin(), vs.end() ); vector::iterator toDelete = unique( vs.begin(), vs.end() ); vs.erase(toDelete, vs.end()); } @@ -5786,8 +5788,8 @@ static RString GetDeviceButtonsLocalized( const vector &veb, const M } } - ProcessKeyNames( vsPress ); - ProcessKeyNames( vsHold ); + ProcessKeyNames( vsPress, false ); + ProcessKeyNames( vsHold, true ); RString s = join("/",vsPress); if( !vsHold.empty() )