Mercurial > vim
changeset 36416:619edaccf299 draft
runtime(netrw): fix regression with x mapping on Cygwin
Commit: https://github.com/vim/vim/commit/9f32069b8c4f74aa6af47e2f0ec07f2745feac57
Author: Christian Brabandt <cb@256bit.org>
Date: Wed Oct 30 18:36:20 2024 +0100
runtime(netrw): fix regression with x mapping on Cygwin
related: https://github.com/vim/vim/issues/13687
Co-authored-by: K.Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 30 Oct 2024 18:45:02 +0100 |
parents | 2fabe88e84c9 |
children | ac4895cab03a |
files | runtime/autoload/netrw.vim |
diffstat | 1 files changed, 4 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -29,6 +29,7 @@ " 2024 Oct 21 by Vim Project: remove netrwFileHandlers (#15895) " 2024 Oct 27 by Vim Project: clean up gx mapping (#15721) " 2024 Oct 30 by Vim Project: fix filetype detection for remote files (#15961) +" 2024 Oct 30 by Vim Project: fix x mapping on cygwin (#13687) " }}} " Former Maintainer: Charles E Campbell " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim @@ -5270,27 +5271,13 @@ endfun " given filename; typically this means given their extension. " 0=local, 1=remote fun! netrw#BrowseX(fname,remote) - let use_ctrlo= 1 -" call Dfunc("netrw#BrowseX(fname<".a:fname."> remote=".a:remote.") implements x and gx maps") - if a:remote == 0 && isdirectory(a:fname) " if its really just a local directory, then do a "gf" instead -" call Decho("remote≡0 and a:fname<".a:fname."> ".(isdirectory(a:fname)? "is a directory" : "is not a directory"),'~'.expand("<slnum>")) -" call Decho("..appears to be a local directory; using e ".a:fname." instead",'~'.expand("<slnum>")) exe "e ".a:fname -" call Dret("netrw#BrowseX") - return elseif a:remote == 1 && a:fname !~ '^https\=:' && a:fname =~ '/$' " remote directory, not a webpage access, looks like an attempt to do a directory listing -" call Decho("remote≡1 and a:fname<".a:fname.">",'~'.expand("<slnum>")) -" call Decho("..and fname ".((a:fname =~ '^https\=:')? 'matches' : 'does not match').'^https\=:','~'.expand("<slnum>")) -" call Decho("..and fname ".((a:fname =~ '/$')? 'matches' : 'does not match').' /$','~'.expand("<slnum>")) -" call Decho("..appears to be a remote directory listing request; using gf instead",'~'.expand("<slnum>")) norm! gf -" call Dret("netrw#BrowseX") - return - endif -" call Decho("not a local file nor a webpage request",'~'.expand("<slnum>")) + endif if exists("g:netrw_browsex_viewer") && exists("g:netrw_browsex_support_remote") && !g:netrw_browsex_support_remote let remote = a:remote @@ -5300,7 +5287,6 @@ fun! netrw#BrowseX(fname,remote) let ykeep = @@ let screenposn = winsaveview() -" call Decho("saving posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>")) " need to save and restore aw setting as gx can invoke this function from non-netrw buffers let awkeep = &aw @@ -5311,22 +5297,18 @@ fun! netrw#BrowseX(fname,remote) if exists("g:Netrw_corehandler") if type(g:Netrw_corehandler) == 2 " g:Netrw_corehandler is a function reference (see :help Funcref) -" call Decho("g:Netrw_corehandler is a funcref",'~'.expand("<slnum>")) call g:Netrw_corehandler(s:NetrwFile(a:fname)) elseif type(g:Netrw_corehandler) == 3 " g:Netrw_corehandler is a List of function references (see :help Funcref) -" call Decho("g:Netrw_corehandler is a List",'~'.expand("<slnum>")) for Fncref in g:Netrw_corehandler if type(Fncref) == 2 call Fncref(a:fname) endif endfor endif -" call Decho("restoring posn: screenposn<".string(screenposn).">,'~'.expand("<slnum>"))" call winrestview(screenposn) let @@= ykeep let &aw= awkeep -" call Dret("netrw#BrowseX : coredump handler invoked") return endif endif @@ -5340,46 +5322,35 @@ fun! netrw#BrowseX(fname,remote) if exten =~ "[\\/]" let exten= "" endif -" call Decho("exten<".exten.">",'~'.expand("<slnum>")) if remote == 1 " create a local copy -" call Decho("remote: remote=".remote.": create a local copy of <".a:fname.">",'~'.expand("<slnum>")) setl bh=delete call netrw#NetRead(3,a:fname) " attempt to rename tempfile let basename= substitute(a:fname,'^\(.*\)/\(.*\)\.\([^.]*\)$','\2','') let newname = substitute(s:netrw_tmpfile,'^\(.*\)/\(.*\)\.\([^.]*\)$','\1/'.basename.'.\3','') -" call Decho("basename<".basename.">",'~'.expand("<slnum>")) -" call Decho("newname <".newname.">",'~'.expand("<slnum>")) if s:netrw_tmpfile != newname && newname != "" if rename(s:netrw_tmpfile,newname) == 0 " renaming succeeded -" call Decho("renaming succeeded (tmpfile<".s:netrw_tmpfile."> to <".newname.">)") let fname= newname else " renaming failed -" call Decho("renaming failed (tmpfile<".s:netrw_tmpfile."> to <".newname.">)") let fname= s:netrw_tmpfile endif else let fname= s:netrw_tmpfile endif else -" call Decho("local: remote=".remote.": handling local copy of <".a:fname.">",'~'.expand("<slnum>")) let fname= a:fname " special ~ handler for local if fname =~ '^\~' && expand("$HOME") != "" -" call Decho('invoking special ~ handler','~'.expand("<slnum>")) let fname= s:NetrwFile(substitute(fname,'^\~',expand("$HOME"),'')) endif endif -" call Decho("fname<".fname.">",'~'.expand("<slnum>")) -" call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten),'~'.expand("<slnum>")) " extract any viewing options. Assumes that they're set apart by spaces. if exists("g:netrw_browsex_viewer") -" call Decho("extract any viewing options from g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>")) if g:netrw_browsex_viewer =~ '\s' let viewer = substitute(g:netrw_browsex_viewer,'\s.*$','','') let viewopt = substitute(g:netrw_browsex_viewer,'^\S\+\s*','','')." " @@ -5390,17 +5361,14 @@ fun! netrw#BrowseX(fname,remote) let viewopt = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\3','')." " let cnt = cnt + 1 let oviewer = viewer -" call Decho("!exe: viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("<slnum>")) endwhile else let viewer = g:netrw_browsex_viewer let viewopt = "" endif -" call Decho("viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("<slnum>")) endif if exists("g:netrw_browsex_viewer") && executable(viewer) -" call Decho("(netrw#BrowseX) g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>")) exe 'Launch' viewer viewopt shellescape(fname, 1) else " though shellescape(..., 1) is used in Open, it's insufficient @@ -5413,7 +5381,6 @@ fun! netrw#BrowseX(fname,remote) " Feb 12, 2008: had to de-activate removal of " temporary file because it wasn't getting seen. " if remote == 1 && fname != a:fname -"" call Decho("deleting temporary file<".fname.">",'~'.expand("<slnum>")) " call s:NetrwDelete(fname) " endif @@ -5422,16 +5389,11 @@ fun! netrw#BrowseX(fname,remote) if g:netrw_use_noswf setl noswf endif - if use_ctrlo - exe "sil! NetrwKeepj norm! \<c-o>" - endif - endif -" call Decho("restoring posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>")) + exe "sil! NetrwKeepj norm! \<c-o>" + endif call winrestview(screenposn) let @@ = ykeep let &aw= awkeep - -" call Dret("netrw#BrowseX") endfun " ---------------------------------------------------------------------