Skip to content

Commit

Permalink
Fix: Netrw Tree Style Listing moves the cursor to a different position.
Browse files Browse the repository at this point in the history
Problem: Netrw Tree Style Listing moves the cursor to a different
         position when the user presses the Enter key to perform a
	 directory listing; in a Netrw buffer that the user has
	 reloaded with ':edit' or ':buffer'.

Solution: The "Perform Directory Listing" part of the function
          's:NetrwBrowse()' should only call 'winrestview()' when the
	  listing style of Netrw is not tree style listing.
  • Loading branch information
jamescherti committed May 18, 2022
1 parent 51f0bfb commit eca3524
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion runtime/autoload/netrw.vim
Expand Up @@ -4048,7 +4048,9 @@ fun! s:NetrwBrowse(islocal,dirname)
" Otherwise : set rexposn
if exists("s:rexposn_".bufnr("%"))
" call Decho("restoring posn to s:rexposn_".bufnr('%')."<".string(s:rexposn_{bufnr('%')}).">",'~'.expand("<slnum>"))
NetrwKeepj call winrestview(s:rexposn_{bufnr('%')})
if ! (exists("w:netrw_liststyle") && w:netrw_liststyle ==# s:TREELIST)
NetrwKeepj call winrestview(s:rexposn_{bufnr('%')})
endif
if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt
NetrwKeepj exe w:netrw_bannercnt
endif
Expand Down

0 comments on commit eca3524

Please sign in to comment.