mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-22 19:11:40 +03:00
selections env var is : separated, and : in selections are escaped
This commit is contained in:
parent
535a454349
commit
3150fe97cf
15
src/main.cc
15
src/main.cc
@ -70,10 +70,17 @@ void register_env_vars()
|
|||||||
{ const Range& sel = context.editor().main_selection();
|
{ const Range& sel = context.editor().main_selection();
|
||||||
return content(context.buffer(), sel); });
|
return content(context.buffer(), sel); });
|
||||||
shell_manager.register_env_var("selections",
|
shell_manager.register_env_var("selections",
|
||||||
[](const String& name, const Context& context)
|
[](const String& name, const Context& context) {
|
||||||
{ auto sels = context.editor().selections_content();
|
auto sels = context.editor().selections_content();
|
||||||
return std::accumulate(sels.begin(), sels.end(), ""_str,
|
String res;
|
||||||
[](const String& lhs, const String& rhs) { return lhs.empty() ? rhs : lhs + "," + rhs; }); });
|
for (size_t i = 0; i < sels.size(); ++i)
|
||||||
|
{
|
||||||
|
res += escape(sels[i], ':', '\\');
|
||||||
|
if (i != sels.size() - 1)
|
||||||
|
res += ':';
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
});
|
||||||
shell_manager.register_env_var("runtime",
|
shell_manager.register_env_var("runtime",
|
||||||
[](const String& name, const Context& context)
|
[](const String& name, const Context& context)
|
||||||
{ return runtime_directory(); });
|
{ return runtime_directory(); });
|
||||||
|
Loading…
Reference in New Issue
Block a user