Use different variable for pipe command in/out text

This commit is contained in:
Maxime Coste 2015-07-13 13:50:36 +01:00
parent 905af05c61
commit c44c8c3d1f

View File

@ -395,19 +395,19 @@ void pipe(Context& context, NormalParams)
Vector<String> strings; Vector<String> strings;
for (auto& sel : selections) for (auto& sel : selections)
{ {
auto str = content(buffer, sel); auto in = content(buffer, sel);
bool insert_eol = str.back() != '\n'; bool insert_eol = in.back() != '\n';
if (insert_eol) if (insert_eol)
str += '\n'; in += '\n';
str = ShellManager::instance().eval( auto out = ShellManager::instance().eval(
real_cmd, context, str, real_cmd, context, in,
ShellManager::Flags::WaitForStdout, ShellManager::Flags::WaitForStdout,
{}, EnvVarMap{}).first; {}, EnvVarMap{}).first;
if ((insert_eol or sel.max() == buffer.back_coord()) and if ((insert_eol or sel.max() == buffer.back_coord()) and
str.back() == '\n') out.back() == '\n')
str = str.substr(0, str.length()-1).str(); out = out.substr(0, out.length()-1).str();
strings.push_back(std::move(str)); strings.push_back(std::move(out));
} }
ScopedEdition edition(context); ScopedEdition edition(context);
selections.insert(strings, InsertMode::Replace); selections.insert(strings, InsertMode::Replace);