fixup! Use empty last line from commands working on multiple selections

We only use the last empty line when there are more than a single line break in the string to be inserted.

The use-case here is having multiple carets and then running a command like “echo foo”. Here we receive “foo\n” which is split into (“foo”, “”), so every second caret would get the empty string inserted.
This commit is contained in:
Allan Odgaard
2015-08-27 23:02:17 +02:00
parent c603b83050
commit 7400fb63ad

View File

@@ -1346,7 +1346,9 @@ namespace ng
if(inputRanges.size() > 1 && format == output_format::text && placement != output::replace_document)
{
std::vector<std::string> const words = text::split(out, "\n");
std::vector<std::string> words = text::split(out, "\n");
if(words.size() == 2 && words.back().empty())
words.pop_back();
size_t i = 0;
std::multimap<range_t, std::string> insertions;