Mirror of the Vim source from https://github.com/vim/vim
Révision | 29eccef07e2f914dc64bdf5f1d80ce13e24b41ec (tree) |
---|---|
l'heure | 2021-01-23 23:30:04 |
Auteur | Bram Moolenaar <Bram@vim....> |
Commiter | Bram Moolenaar |
patch 8.2.2397: Vim9: "%%" not seen as alternate file name for ":bdel"
Commit: https://github.com/vim/vim/commit/dfbc5fd879d92c2a79ced1e1d16dc89f4d55772d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 23 15:15:01 2021 +0100
@@ -2564,12 +2564,15 @@ | ||
2564 | 2564 | char_u *p; |
2565 | 2565 | int toggledollar; |
2566 | 2566 | |
2567 | - if (pattern_end == pattern + 1 && (*pattern == '%' || *pattern == '#')) | |
2567 | + // "%" is current file, "%%" or "#" is alternate file | |
2568 | + if ((pattern_end == pattern + 1 && (*pattern == '%' || *pattern == '#')) | |
2569 | + || (in_vim9script() && pattern_end == pattern + 2 | |
2570 | + && pattern[0] == '%' && pattern[1] == '%')) | |
2568 | 2571 | { |
2569 | - if (*pattern == '%') | |
2572 | + if (*pattern == '#' || pattern_end == pattern + 2) | |
2573 | + match = curwin->w_alt_fnum; | |
2574 | + else | |
2570 | 2575 | match = curbuf->b_fnum; |
2571 | - else | |
2572 | - match = curwin->w_alt_fnum; | |
2573 | 2576 | #ifdef FEAT_DIFF |
2574 | 2577 | if (diffmode && !diff_mode_buf(buflist_findnr(match))) |
2575 | 2578 | match = -1; |
@@ -68,6 +68,17 @@ | ||
68 | 68 | edit Xfiletwo |
69 | 69 | edit %%:r |
70 | 70 | assert_equal('Xfileone', bufname()) |
71 | + | |
72 | + assert_false(bufexists('altfoo')) | |
73 | + edit altfoo | |
74 | + edit bar | |
75 | + assert_true(bufexists('altfoo')) | |
76 | + assert_true(buflisted('altfoo')) | |
77 | + bdel %% | |
78 | + assert_true(bufexists('altfoo')) | |
79 | + assert_false(buflisted('altfoo')) | |
80 | + bwipe! altfoo | |
81 | + bwipe! bar | |
71 | 82 | END |
72 | 83 | CheckDefAndScriptSuccess(lines) |
73 | 84 | enddef |
@@ -751,6 +751,8 @@ | ||
751 | 751 | static int included_patches[] = |
752 | 752 | { /* Add new patch number below this line */ |
753 | 753 | /**/ |
754 | + 2397, | |
755 | +/**/ | |
754 | 756 | 2396, |
755 | 757 | /**/ |
756 | 758 | 2395, |