]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0761: runtime(netrw): Unix: unable to open '\' file v9.2.0761
authorManoj Panda <manojpandawork@gmail.com>
Wed, 1 Jul 2026 19:46:47 +0000 (19:46 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 1 Jul 2026 19:49:05 +0000 (19:49 +0000)
Problem:  runtime(netrw): Unix: unable to open '\' file
Solution: Adjust directory pattern (Manoj Panda)

closes: #20685

Signed-off-by: Manoj Panda <manojpandawork@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/pack/dist/opt/netrw/autoload/netrw.vim
src/testdir/test_plugin_netrw.vim
src/version.c

index 1535644d270eb5974cca21007b2a1b8ea3478194..4dc60eefa125b08d4015ea0814525d227c002094 100644 (file)
@@ -1,7 +1,7 @@
 " 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
@@ -3862,7 +3862,7 @@ function s:NetrwBrowseChgDir(islocal, newdir, cursor, ...)
     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))))
         " ------------------------------
index ea3f33cecec17d886adab8d4ed025ad74d50baac..896e83ec46a86d530dd26209094e370dec0342a3 100644 (file)
@@ -878,4 +878,27 @@ func Test_netrw_forward_slashes()
   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
index 724eda425140ba25866f9fd21de4a946db8d5c90..7546d03195f91f8c5476b281f459cd7799107c0e 100644 (file)
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    761,
 /**/
     760,
 /**/