diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-07-12 14:30:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-12 14:30:49 +0800 |
commit | 028dd3c5c4d1828eec64c099d3372ffb90572dc0 (patch) | |
tree | 45e4625195d0c27e91e01b0455b6b99022f0ae06 /src | |
parent | bcb17689da4fef9059f0c0fae2f1493969b0a78c (diff) | |
download | rneovim-028dd3c5c4d1828eec64c099d3372ffb90572dc0.tar.gz rneovim-028dd3c5c4d1828eec64c099d3372ffb90572dc0.tar.bz2 rneovim-028dd3c5c4d1828eec64c099d3372ffb90572dc0.zip |
vim-patch:9.1.0569: fnamemodify() treats ".." and "../" differently (#29673)
Problem: fnamemodify() treats ".." and "../" differently.
Solution: Expand ".." properly like how "/.." is treated in 8.2.3388.
(zeertzjq)
closes: vim/vim#15218
https://github.com/vim/vim/commit/1ee7420460768df67ea4bc73467f2d4f8b1555bd
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/path.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c index e33e34fff3..adea7ff0f7 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -2393,9 +2393,13 @@ static int path_to_absolute(const char *fname, char *buf, size_t len, int force) p = strrchr(fname, '\\'); } #endif + if (p == NULL && strcmp(fname, "..") == 0) { + // Handle ".." without path separators. + p = fname + 2; + } if (p != NULL) { - if (strcmp(p + 1, "..") == 0) { - // for "/path/dir/.." include the "/.." + if (vim_ispathsep_nocolon(*p) && strcmp(p + 1, "..") == 0) { + // For "/path/dir/.." include the "/..". p += 3; } assert(p >= fname); |