Mercurial > vim
comparison src/session.c @ 28083:f1c00b8085f6 v8.2.4566
patch 8.2.4566: check for existing buffer in session file may not work
Commit: https://github.com/vim/vim/commit/7d42840033aedf36389208b62e28b4e0b251c199
Author: James Cherti <60946298+jamescherti@users.noreply.github.com>
Date: Mon Mar 14 20:24:51 2022 +0000
patch 8.2.4566: check for existing buffer in session file may not work
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 14 Mar 2022 21:30:02 +0100 |
parents | 4fd87205ca80 |
children | 800e7de2f96d |
comparison
equal
deleted
inserted
replaced
28082:49854e230525 | 28083:f1c00b8085f6 |
---|---|
383 // This may have side effects! (e.g., compressed or network file). | 383 // This may have side effects! (e.g., compressed or network file). |
384 // | 384 // |
385 // Note, if a buffer for that file already exists, use :badd to | 385 // Note, if a buffer for that file already exists, use :badd to |
386 // edit that buffer, to not lose folding information (:edit resets | 386 // edit that buffer, to not lose folding information (:edit resets |
387 // folds in other buffers) | 387 // folds in other buffers) |
388 if (fputs("if bufexists(\"", fd) < 0 | 388 if (fputs("if bufexists(fnamemodify(\"", fd) < 0 |
389 || ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL | 389 || ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL |
390 || fputs("\") | buffer ", fd) < 0 | 390 || fputs("\", \":p\")) | buffer ", fd) < 0 |
391 || ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL | 391 || ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL |
392 || fputs(" | else | edit ", fd) < 0 | 392 || fputs(" | else | edit ", fd) < 0 |
393 || ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL | 393 || ses_fname(fd, wp->w_buffer, flagp, FALSE) == FAIL |
394 || fputs(" | endif", fd) < 0 | 394 || fputs(" | endif", fd) < 0 |
395 || put_eol(fd) == FAIL) | 395 || put_eol(fd) == FAIL) |