From 43e3d3bcf2bfae89a379160091fdf206d0aa841d Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Fri, 24 May 2019 16:51:40 -0700 Subject: [PATCH] Fix the argparse tests --- src/expand.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/expand.cpp b/src/expand.cpp index fade270cd..a2bae217c 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -135,7 +135,9 @@ wcstring expand_escape_variable(const env_var_t &var) { const wcstring &el = lst.at(j); if (j) buff.append(L" "); - if (is_quotable(el)) { + // We want to use quotes if we have more than one string, or the string contains a space. + bool prefer_quotes = lst.size() > 1 || el.find(L' ') != wcstring::npos; + if (prefer_quotes && is_quotable(el)) { buff.append(L"'"); buff.append(el); buff.append(L"'");