diff --git a/src/commands/CmdIDs.cpp b/src/commands/CmdIDs.cpp index 5d0e0ffcc..efcbbd298 100644 --- a/src/commands/CmdIDs.cpp +++ b/src/commands/CmdIDs.cpp @@ -38,6 +38,8 @@ extern Context context; +std::string zshColonReplacement = ","; + //////////////////////////////////////////////////////////////////////////////// CmdIDs::CmdIDs () { @@ -131,7 +133,7 @@ int CmdZshCompletionIds::execute (std::string& output) task->getStatus () != Task::completed) out << task->id << ":" - << task->get ("description") + << str_replace(task->get ("description"), ":", zshColonReplacement) << "\n"; output = out.str (); @@ -228,7 +230,7 @@ int CmdZshCompletionUuids::execute (std::string& output) for (task = filtered.begin (); task != filtered.end (); ++task) out << task->get ("uuid") << ":" - << task->get ("description") + << str_replace (task->get ("description"), ":", zshColonReplacement) << "\n"; output = out.str (); diff --git a/src/text.cpp b/src/text.cpp index 99f5da43a..067404764 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -527,6 +527,16 @@ const std::string str_replace ( return str; } +//////////////////////////////////////////////////////////////////////////////// +const std::string str_replace ( + const std::string& str, + const std::string& search, + const std::string& replacement) +{ + std::string modified = str; + return str_replace (modified, search, replacement); +} + //////////////////////////////////////////////////////////////////////////////// const char* optionalBlankLine () { diff --git a/src/text.h b/src/text.h index cf90dbfc0..2bd2f4c21 100644 --- a/src/text.h +++ b/src/text.h @@ -53,6 +53,7 @@ std::string lowerCase (const std::string&); std::string upperCase (const std::string&); std::string ucFirst (const std::string&); const std::string str_replace (std::string&, const std::string&, const std::string&); +const std::string str_replace (const std::string&, const std::string&, const std::string&); const char* optionalBlankLine (); void guess (const std::string&, std::vector&, std::string&); bool nontrivial (const std::string&);