patch 9.1.1572: expanding $var does not escape whitespace for 'path'

Problem:  expanding $var does not escape whitespace for 'path'
Solution: Escape whitespace when expanding 'path' option.
          (Miguel Barro)

closes: #17801

Signed-off-by: Miguel Barro <miguel.barro@live.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Miguel Barro
2025-07-20 10:47:14 +02:00
committed by Christian Brabandt
parent 239c4e4abe
commit 8b004081c4
3 changed files with 40 additions and 5 deletions

View File

@ -2927,14 +2927,16 @@ option_expand(int opt_idx, char_u *val)
/*
* Expanding this with NameBuff, expand_env() must not be passed IObuff.
* Escape spaces when expanding 'tags', they are used to separate file
* names.
* Escape spaces when expanding 'tags' or 'path', they are used to separate
* file names.
* For 'spellsuggest' expand after "file:".
*/
expand_env_esc(val, NameBuff, MAXPATHL,
(char_u **)options[opt_idx].var == &p_tags, FALSE,
char_u ** var = (char_u **)options[opt_idx].var;
int esc = var == &p_tags || var == &p_path;
expand_env_esc(val, NameBuff, MAXPATHL, esc, FALSE,
#ifdef FEAT_SPELL
(char_u **)options[opt_idx].var == &p_sps ? (char_u *)"file:" :
var == &p_sps ? (char_u *)"file:" :
#endif
NULL);
if (STRCMP(NameBuff, val) == 0) // they are the same