mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-26 13:02:01 +03:00
simplify echo code, avoid trailing spaces
This commit is contained in:
parent
32319aca45
commit
7cdeb3d7f7
@ -780,9 +780,7 @@ const CommandDesc echo_cmd = {
|
|||||||
CommandCompleter{},
|
CommandCompleter{},
|
||||||
[](const ParametersParser& parser, Context& context)
|
[](const ParametersParser& parser, Context& context)
|
||||||
{
|
{
|
||||||
String message;
|
String message = join(parser, ' ', false);
|
||||||
for (auto& param : parser)
|
|
||||||
message += param + " ";
|
|
||||||
if (parser.has_option("debug"))
|
if (parser.has_option("debug"))
|
||||||
write_debug(message);
|
write_debug(message);
|
||||||
else
|
else
|
||||||
|
@ -242,14 +242,14 @@ String escape(StringView str, StringView characters, char escape);
|
|||||||
String unescape(StringView str, StringView characters, char escape);
|
String unescape(StringView str, StringView characters, char escape);
|
||||||
|
|
||||||
template<typename Container>
|
template<typename Container>
|
||||||
String join(const Container& container, char joiner)
|
String join(const Container& container, char joiner, bool esc_joiner = true)
|
||||||
{
|
{
|
||||||
String res;
|
String res;
|
||||||
for (const auto& str : container)
|
for (const auto& str : container)
|
||||||
{
|
{
|
||||||
if (not res.empty())
|
if (not res.empty())
|
||||||
res += joiner;
|
res += joiner;
|
||||||
res += escape(str, joiner, '\\');
|
res += esc_joiner ? escape(str, joiner, '\\') : str;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user