From 357f49c781e6b32915b8925cf19b6d500959e308 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 28 Oct 2021 18:08:37 +0200 Subject: [PATCH] Revert "Use unescape_string_in_place" This reverts commit 2ef8a9c1af3b30b8d59d917500c25db5bcd55111. This doesn't work everywhere, not sure why. --- src/expand.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/expand.cpp b/src/expand.cpp index 0c0874418..0666ad907 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -1001,20 +1001,22 @@ expand_result_t expander_t::stage_cmdsubst(wcstring input, completion_receiver_t expand_result_t expander_t::stage_variables(wcstring input, completion_receiver_t *out) { // We accept incomplete strings here, since complete uses expand_string to expand incomplete // strings from the commandline. - unescape_string_in_place(&input, UNESCAPE_SPECIAL | UNESCAPE_INCOMPLETE); + wcstring next; + unescape_string(input, &next, UNESCAPE_SPECIAL | UNESCAPE_INCOMPLETE); if (flags & expand_flag::skip_variables) { - for (auto &i : input) { + for (auto &i : next) { if (i == VARIABLE_EXPAND) { i = L'$'; } } - if (!out->add(std::move(input))) { + if (!out->add(std::move(next))) { return append_overflow_error(errors); } return expand_result_t::ok; } else { - return expand_variables(std::move(input), out, input.size(), ctx.vars, errors); + size_t size = next.size(); + return expand_variables(std::move(next), out, size, ctx.vars, errors); } }