mirror of
https://github.com/neovim/neovim.git
synced 2026-07-27 11:06:38 +00:00
vim-patch:9.2.0676: MS-Windows: cannot switch to a buffer with '%' in its name (#40315)
Problem: On MS-Windows it is not possible to switch to a buffer by name
with ":b" (including via command-line completion) when the
buffer name contains '%'.
Solution: Do not escape '%' and '#' for the ":buffer" command on
MS-Windows. Since ":buffer" has no EX_XFILE these are not
expanded, and escaping them as "\%"/"\#" makes buffer name
matching fail when '%'/'#' is in 'isfname' (the backslash is
treated as a path separator).
fixes: vim/vim#20529
closes: vim/vim#20548
1a96e07bf6
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -937,4 +937,19 @@ func Test_split_window_in_BufLeave_from_switching_buffer()
|
||||
bwipe! Xb
|
||||
endfunc
|
||||
|
||||
" Switch to a buffer whose name contains '%' via completion (#20529).
|
||||
func Test_buffer_switch_to_name_with_percent()
|
||||
CheckMSWindows
|
||||
|
||||
let bufnr = bufadd('Xpercent%name')
|
||||
call setbufvar(bufnr, '&buflisted', 1)
|
||||
call bufload(bufnr)
|
||||
enew
|
||||
|
||||
call feedkeys(":b Xpercent\<Tab>\<CR>", 'xt')
|
||||
call assert_equal(bufnr, bufnr('%'))
|
||||
|
||||
exe 'bwipe! ' .. bufnr
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
Reference in New Issue
Block a user