diff --git a/src/commands/CmdContext.cpp b/src/commands/CmdContext.cpp index b867a546d..142aa88d8 100644 --- a/src/commands/CmdContext.cpp +++ b/src/commands/CmdContext.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -109,13 +110,20 @@ std::string CmdContext::joinWords (const std::vector & words, unsig // std::vector CmdContext::getContexts () { - std::vector contexts; + std::set contexts; for (auto& name : Context::getContext ().config) if (name.first.substr (0, 8) == "context.") - contexts.push_back (name.first.substr (8)); + { + std::string suffix = name.first.substr (8); - return contexts; + if (suffix.find (".") != std::string::npos) + contexts.insert (suffix.substr (0, suffix.find ("."))); + else + contexts.insert (suffix); + } + + return std::vector (contexts.begin (), contexts.end ()); } ////////////////////////////////////////////////////////////////////////////////