diff options
author | Bram Moolenaar <Bram@vim.org> | 2007-09-25 18:40:14 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2007-09-25 18:40:14 +0000 |
commit | 5461cfe289b5a4a1ab9660e4e6145d13e8db9e57 (patch) | |
tree | aa5558f6f8083862ddc943d8ca008ed8d91e5b2f /src/eval.c | |
parent | 9d2c8c1a66c2f354f06065d8261ac87e6c407097 (diff) | |
download | vim-git-5461cfe289b5a4a1ab9660e4e6145d13e8db9e57.tar.gz |
updated for version 7.1-121v7.1.121
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/eval.c b/src/eval.c index 61d7df4cf..740b8dd41 100644 --- a/src/eval.c +++ b/src/eval.c @@ -21308,14 +21308,27 @@ repeat: *usedlen += 2; s = get_past_head(*fnamep); while (tail > s && after_pathsep(s, tail)) - --tail; + mb_ptr_back(*fnamep, tail); *fnamelen = (int)(tail - *fnamep); #ifdef VMS if (*fnamelen > 0) *fnamelen += 1; /* the path separator is part of the path */ #endif - while (tail > s && !after_pathsep(s, tail)) - mb_ptr_back(*fnamep, tail); + if (*fnamelen == 0) + { + /* Result is empty. Turn it into "." to make ":cd %:h" work. */ + p = vim_strsave((char_u *)"."); + if (p == NULL) + return -1; + vim_free(*bufp); + *bufp = *fnamep = tail = p; + *fnamelen = 1; + } + else + { + while (tail > s && !after_pathsep(s, tail)) + mb_ptr_back(*fnamep, tail); + } } /* ":8" - shortname */ |