0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.2397: Vim9: "%%" not seen as alternate file name for ":bdel"

Problem:    Vim9: "%%" not seen as alternate file name for commands with a
            buffer name argument.
Solution:   Recognize "%%" like "#". (closes #7732)
This commit is contained in:
Bram Moolenaar
2021-01-23 15:15:01 +01:00
parent 7cebe8ba7d
commit dfbc5fd879
3 changed files with 20 additions and 4 deletions

View File

@@ -2564,12 +2564,15 @@ buflist_findpat(
char_u *p;
int toggledollar;
if (pattern_end == pattern + 1 && (*pattern == '%' || *pattern == '#'))
// "%" is current file, "%%" or "#" is alternate file
if ((pattern_end == pattern + 1 && (*pattern == '%' || *pattern == '#'))
|| (in_vim9script() && pattern_end == pattern + 2
&& pattern[0] == '%' && pattern[1] == '%'))
{
if (*pattern == '%')
match = curbuf->b_fnum;
else
if (*pattern == '#' || pattern_end == pattern + 2)
match = curwin->w_alt_fnum;
else
match = curbuf->b_fnum;
#ifdef FEAT_DIFF
if (diffmode && !diff_mode_buf(buflist_findnr(match)))
match = -1;