parent
dc84cdd538
commit
2bdd361948
|
@ -330,12 +330,13 @@ String replace(StringView str, StringView substr, StringView replacement);
|
||||||
template<typename Container>
|
template<typename Container>
|
||||||
String join(const Container& container, char joiner, bool esc_joiner = true)
|
String join(const Container& container, char joiner, bool esc_joiner = true)
|
||||||
{
|
{
|
||||||
|
const char to_escape[] = { joiner, '\\' };
|
||||||
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 += esc_joiner ? escape(str, joiner, '\\') : str;
|
res += esc_joiner ? escape(str, to_escape, '\\') : str;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
1
test/regression/1014-ambiguous-kak_selections/cmd
Normal file
1
test/regression/1014-ambiguous-kak_selections/cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
%<a-s>H
|
3
test/regression/1014-ambiguous-kak_selections/in
Normal file
3
test/regression/1014-ambiguous-kak_selections/in
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
foo\:bar
|
||||||
|
foo\\
|
||||||
|
bar
|
1
test/regression/1014-ambiguous-kak_selections/selections
Normal file
1
test/regression/1014-ambiguous-kak_selections/selections
Normal file
|
@ -0,0 +1 @@
|
||||||
|
foo\\\:bar:foo\\\\:bar
|
Loading…
Reference in New Issue
Block a user