command_manager: only remove last eol in %sh{} expansions
This makes it possible to keep significant EOL in shell expansions (e.g. for use with clipboard helpers).
This commit is contained in:
parent
958a943121
commit
7cde146807
|
@ -323,14 +323,9 @@ expand_token(const Token& token, const Context& context, const ShellContext& she
|
||||||
content, context, {}, ShellManager::Flags::WaitForStdout,
|
content, context, {}, ShellManager::Flags::WaitForStdout,
|
||||||
shell_context).first;
|
shell_context).first;
|
||||||
|
|
||||||
int trailing_eol_count = 0;
|
if (str.back() == '\n')
|
||||||
for (auto c : str | reverse())
|
str.resize(str.length() - 1, 0);
|
||||||
{
|
|
||||||
if (c != '\n')
|
|
||||||
break;
|
|
||||||
++trailing_eol_count;
|
|
||||||
}
|
|
||||||
str.resize(str.length() - trailing_eol_count, 0);
|
|
||||||
return {str};
|
return {str};
|
||||||
}
|
}
|
||||||
case Token::Type::RegisterExpand:
|
case Token::Type::RegisterExpand:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user