Handle hyphens in user-mode names

Fix #1921
This commit is contained in:
Delapouite 2018-03-11 14:58:07 +01:00
parent e66073bc94
commit d5d23834f6

View File

@ -61,7 +61,7 @@ void KeymapManager::add_user_mode(String user_mode_name)
if (contains(user_modes(), user_mode_name)) if (contains(user_modes(), user_mode_name))
throw runtime_error(format("user mode '{}' already defined", user_mode_name)); throw runtime_error(format("user mode '{}' already defined", user_mode_name));
if (contains_that(user_mode_name, [](char c){ return not isalnum(c); })) if (contains_that(user_mode_name, is_blank))
throw runtime_error(format("invalid mode name: '{}'", user_mode_name)); throw runtime_error(format("invalid mode name: '{}'", user_mode_name));
user_modes().push_back(std::move(user_mode_name)); user_modes().push_back(std::move(user_mode_name));