summaryrefslogtreecommitdiff
path: root/src/session.c
diff options
context:
space:
mode:
authorJames Cherti <60946298+jamescherti@users.noreply.github.com>2022-03-14 20:24:51 +0000
committerBram Moolenaar <Bram@vim.org>2022-03-14 20:24:51 +0000
commit7d42840033aedf36389208b62e28b4e0b251c199 (patch)
treeabb1ea5b7e08438e294ad1ef31a734b54b68e94a /src/session.c
parent6e2e2cc95b913e33145047e0fade5193da6e4379 (diff)
downloadvim-git-7d42840033aedf36389208b62e28b4e0b251c199.tar.gz
patch 8.2.4566: check for existing buffer in session file may not workv8.2.4566
Problem: Check for existing buffer in session file does not work for files in the home directory. Solution: Use fnamemodify(). (James Cherti, closes #9945) Add a test.
Diffstat (limited to 'src/session.c')
-rw-r--r--src/session.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/session.c b/src/session.c
index 68e40db80..fa77f89c8 100644
--- a/src/session.c
+++ b/src/session.c
@@ -385,9 +385,9 @@ put_view(
// Note, if a buffer for that file already exists, use :badd to
// edit that buffer, to not lose folding information (:edit resets
// folds in other buffers)
- if (fputs("if bufexists(\"", fd) < 0
+ if (fputs("if bufexists(fnamemodify(\"", fd) < 0
|| ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL
- || fputs("\") | buffer ", fd) < 0
+ || fputs("\", \":p\")) | buffer ", fd) < 0
|| ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL
|| fputs(" | else | edit ", fd) < 0
|| ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL