" Creator: Charles E Campbell
" Previous Maintainer: Luca Saccarola <github.e41mv@aleeas.com>
" Maintainer: This runtime file is looking for a new maintainer.
-" Last Change: 2026 Jun 28
+" Last Change: 2026 Jul 01
" Copyright: Copyright (C) 2016 Charles E. Campbell {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
endif
" set up o/s-dependent directory recognition pattern
- let dirpat = has("amiga") ? '[\/:]$' : '[\/]$'
+ let dirpat = has("amiga") || has('win32') ? '[\/:]$' : '/$'
if newdir !~ dirpat && !(a:islocal && isdirectory(s:NetrwFile(netrw#fs#ComposePath(dirname, newdir))))
" ------------------------------
bw!
endfunc
+" Selecting a file whose name is a single backslash
+func Test_netrw_open_backslash_file()
+ CheckUnix
+
+ let dir = getcwd() . '/Xbslash'
+ let fname = dir . '/\'
+ call mkdir(dir, 'p')
+ call writefile(['backslash file content'], fname)
+ call assert_true(filereadable(fname))
+
+ " list the directory and move onto the '\' entry
+ exe 'Explore ' .. dir
+ call assert_true(search('^\\$', 'w') > 0)
+
+ " open it
+ exe "normal \<CR>"
+
+ call assert_equal('\', expand('%:t'))
+ call assert_equal(['backslash file content'], getline(1, '$'))
+
+ bw!
+endfunc
+
" vim:ts=8 sts=2 sw=2 et