aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-10-13 18:31:36 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-10-13 18:52:46 +0800
commit8c8c6fb05a993574abfa58784c62a1b983565785 (patch)
tree5e78f86180c5f2550ced70fe3627a4cbd7089887 /src
parent2d24558c285198d2e725c83a8c4ad4d90797c950 (diff)
downloadrneovim-8c8c6fb05a993574abfa58784c62a1b983565785.tar.gz
rneovim-8c8c6fb05a993574abfa58784c62a1b983565785.tar.bz2
rneovim-8c8c6fb05a993574abfa58784c62a1b983565785.zip
vim-patch:8.2.0985: simplify() does not remove slashes from "///path"
Problem: Simplify() does not remove slashes from "///path". Solution: Reduce > 2 slashes to one. (closes vim/vim#6263) https://github.com/vim/vim/commit/fdcbe3c3fedf48a43b22938c9331addb2f1182f1 Omit Test_readdirex() change: changed again in patch 9.0.0323. Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/path.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 4c16adde4c..80890acb7d 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -1538,6 +1538,13 @@ void simplify_filename(char *filename)
} while (vim_ispathsep(*p));
}
char *start = p; // remember start after "c:/" or "/" or "///"
+#ifdef UNIX
+ // Posix says that "//path" is unchanged but "///path" is "/path".
+ if (start > filename + 2) {
+ STRMOVE(filename + 1, p);
+ start = p = filename + 1;
+ }
+#endif
do {
// At this point "p" is pointing to the char following a single "/"