aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/memline.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-17 09:48:39 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-07-26 07:18:30 +0800
commit4bb6cd4c2d34d9ddde1999a2b8cb366dd9fd3e4a (patch)
tree33c8a607ac9e4b8f456a61313ef62fd9c2cb7505 /src/nvim/memline.c
parentdd61be59af5bb97f2f28ec0040ab1597795a48c5 (diff)
downloadrneovim-4bb6cd4c2d34d9ddde1999a2b8cb366dd9fd3e4a.tar.gz
rneovim-4bb6cd4c2d34d9ddde1999a2b8cb366dd9fd3e4a.tar.bz2
rneovim-4bb6cd4c2d34d9ddde1999a2b8cb366dd9fd3e4a.zip
vim-patch:8.2.3543: swapname has double slash when 'directory' ends in it
Problem: Swapname has double slash when 'directory' ends in double slash. (Shane Smith) Solution: Remove the superfluous slash. (closes vim/vim#8876) https://github.com/vim/vim/commit/8b0e62c93b6dad5ec5b2c7558d4f7b78c46216d2 Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/memline.c')
-rw-r--r--src/nvim/memline.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 5acf4f0c37..29dd584712 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -1440,7 +1440,10 @@ int recover_names(char *fname, bool do_list, list_T *ret_list, int nr, char **fn
/// Append the full path to name with path separators made into percent
/// signs, to dir. An unnamed buffer is handled as "" (<currentdir>/"")
-char *make_percent_swname(const char *dir, const char *name)
+/// signs, to "dir". An unnamed buffer is handled as "" (<currentdir>/"")
+/// The last character in "dir" must be an extra slash or backslash, it is
+/// removed.
+char *make_percent_swname(char *dir, const char *name)
FUNC_ATTR_NONNULL_ARG(1)
{
char *d = NULL;
@@ -1455,6 +1458,8 @@ char *make_percent_swname(const char *dir, const char *name)
*d = '%';
}
}
+
+ dir[strlen(dir) - 1] = NUL; // remove one trailing slash
d = concat_fnames(dir, s, true);
xfree(s);
xfree(f);