]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(netrw): only keep cursor position in tree listing mode
authorTom Benham <tom.benham13@gmail.com>
Thu, 11 Sep 2025 19:15:43 +0000 (15:15 -0400)
committerChristian Brabandt <cb@256bit.org>
Thu, 11 Sep 2025 19:15:43 +0000 (15:15 -0400)
fixes: #16255
closes: #18275

Signed-off-by: Tom Benham <tom.benham13@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/pack/dist/opt/netrw/autoload/netrw.vim

index 6863c222dfbaff709d15774d1a898de60aaa62cc..0168d234892a945376bba687b57760c8ec95df24 100644 (file)
@@ -6,6 +6,7 @@
 " 2025 Aug 07 by Vim Project (netrw#BrowseX() distinguishes remote files #17794)
 " 2025 Aug 22 by Vim Project netrw#Explore handle terminal correctly #18069
 " 2025 Sep 05 by Vim Project ensure netrw#fs#Dirname() returns trailing slash #18199
+" 2025 Sep 11 by Vim Project only keep cursor position in tree mode #18275
 " 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
@@ -3083,7 +3084,7 @@ function s:NetrwBrowse(islocal,dirname)
     " previous buffer
     let prevbufnr = bufnr('%')
     let reusing= s:NetrwGetBuffer(a:islocal,dirname)
-    if exists("s:rexposn_".prevbufnr)
+    if exists("s:rexposn_".prevbufnr) && exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
         let s:rexposn_{bufnr('%')} = s:rexposn_{prevbufnr}
     endif