Index: trunk/ChameleonPrefPane/Sources/string_util.h =================================================================== --- trunk/ChameleonPrefPane/Sources/string_util.h (revision 430) +++ trunk/ChameleonPrefPane/Sources/string_util.h (revision 431) @@ -79,6 +79,17 @@ return trim_left( trim_right( src , substr) , substr ); } +/** + * trim the space chars (or any substring) on the left of a string + */ +inline std::string string_left( const std::string& source, const std::string& substr = " ") +{ + std::string str = source; + std::string::size_type pos = source.find_first_of(substr); + return pos!=std::string::npos ? str.erase(source.find_first_of(substr) ) : str; +} + + inline char HexToDec(char nibble) { nibble = toupper(nibble); return (nibble < 'A') ? nibble - '0' : nibble - 'A' +10;} #endif Index: trunk/ChameleonPrefPane/Sources/PreferencesControllerBase.mm =================================================================== --- trunk/ChameleonPrefPane/Sources/PreferencesControllerBase.mm (revision 430) +++ trunk/ChameleonPrefPane/Sources/PreferencesControllerBase.mm (revision 431) @@ -292,7 +292,7 @@ { std::string contentValue = trim( [ [(NSTextField*) bod->contentID stringValue] UTF8String ]); - kernelFlags.removeFlag(kernelFlags.stringFromKey(bod->Name)); + kernelFlags.removeFlag(bod->Name); if(val && contentValue.length()>0) { std::string concat = trim(name); Index: trunk/ChameleonPrefPane/Sources/KernOptionsParser.cpp =================================================================== --- trunk/ChameleonPrefPane/Sources/KernOptionsParser.cpp (revision 430) +++ trunk/ChameleonPrefPane/Sources/KernOptionsParser.cpp (revision 431) @@ -59,17 +59,28 @@ // remove a flag in the string void KernOptionsParser::removeFlag(const std::string& flag) { - std::string::size_type found = _options.find(flag); + if (flag.length()==0) return; // not a flag, bye + std::string::size_type pos, l = _options.length(); + if (l==0) return; // empty options nothing to do + std::string f = string_left(flag, "="); + std::string::size_type found = _options.find(f); if (found==std::string::npos) return; - _options.erase(found, found+flag.length()); + // find the end of the flag + for ( pos=found+flag.length(); pos