runtime(netrw): Use :exec norm! <leftmouse> before :call mapping in netrw 
(#12180)

Commit: 
https://github.com/vim/vim/commit/bdb9d9afba9769b1cb9c0b320086142d99034c9a
Author: user202729 <[email protected]>
Date:   Mon Jan 29 05:29:21 2024 +0700

    runtime(netrw): Use :exec norm! <leftmouse> before :call mapping in netrw 
(https://github.com/vim/vim/issues/12180)
    
    fixes: https://github.com/vim/vim/issues/12143
    
    Signed-off-by: user202729 <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index 295808877..0006d133c 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -6679,14 +6679,14 @@ fun! s:NetrwMaps(islocal)
     nmap <buffer>                      <2-leftmouse>           
<Plug>Netrw2Leftmouse
     imap <buffer>                      <leftmouse>             <Plug>ILeftmouse
     imap <buffer>                      <middlemouse>           
<Plug>IMiddlemouse
-    nno  <buffer> <silent>             <Plug>NetrwLeftmouse    
<leftmouse>:call <SID>NetrwLeftmouse(1)<cr>
-    nno  <buffer> <silent>             <Plug>NetrwCLeftmouse   
<leftmouse>:call <SID>NetrwCLeftmouse(1)<cr>
-    nno  <buffer> <silent>             <Plug>NetrwMiddlemouse  
<leftmouse>:call <SID>NetrwPrevWinOpen(1)<cr>
-    nno  <buffer> <silent>             <Plug>NetrwSLeftmouse   
<leftmouse>:call <SID>NetrwSLeftmouse(1)<cr>
-    nno  <buffer> <silent>             <Plug>NetrwSLeftdrag    
<leftmouse>:call <SID>NetrwSLeftdrag(1)<cr>
+    nno  <buffer> <silent>             <Plug>NetrwLeftmouse    :exec "norm! 
\<lt>leftmouse>"<bar>call <SID>NetrwLeftmouse(1)<cr>
+    nno  <buffer> <silent>             <Plug>NetrwCLeftmouse   :exec "norm! 
\<lt>leftmouse>"<bar>call <SID>NetrwCLeftmouse(1)<cr>
+    nno  <buffer> <silent>             <Plug>NetrwMiddlemouse  :exec "norm! 
\<lt>leftmouse>"<bar>call <SID>NetrwPrevWinOpen(1)<cr>
+    nno  <buffer> <silent>             <Plug>NetrwSLeftmouse   :exec "norm! 
\<lt>leftmouse>"<bar>call <SID>NetrwSLeftmouse(1)<cr>
+    nno  <buffer> <silent>             <Plug>NetrwSLeftdrag    :exec "norm! 
\<lt>leftmouse>"<bar>call <SID>NetrwSLeftdrag(1)<cr>
     nmap <buffer> <silent>             <Plug>Netrw2Leftmouse   -
-    exe 'nnoremap <buffer> <silent> <rightmouse>  <leftmouse>:call 
<SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
-    exe 'vnoremap <buffer> <silent> <rightmouse>  <leftmouse>:call 
<SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
+    exe 'nnoremap <buffer> <silent> <rightmouse>  :exec "norm! 
\<lt>leftmouse>"<bar>call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
+    exe 'vnoremap <buffer> <silent> <rightmouse>  :exec "norm! 
\<lt>leftmouse>"<bar>call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
    endif
    exe 'nnoremap <buffer> <silent> <nowait> <del>      :call 
<SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
    exe 'nnoremap <buffer> <silent> <nowait> D          :call 
<SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
@@ -6780,22 +6780,22 @@ fun! s:NetrwMaps(islocal)
    nnoremap <buffer> <silent> <Plug>NetrwRefresh       :call 
<SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
    if g:netrw_mousemaps == 1
     nmap <buffer> <leftmouse>          <Plug>NetrwLeftmouse
-    nno  <buffer> <silent>             <Plug>NetrwLeftmouse    
<leftmouse>:call <SID>NetrwLeftmouse(0)<cr>
+    nno  <buffer> <silent>             <Plug>NetrwLeftmouse    :exec "norm! 
\<lt>leftmouse>"<bar>call <SID>NetrwLeftmouse(0)<cr>
     nmap <buffer> <c-leftmouse>                <Plug>NetrwCLeftmouse
-    nno  <buffer> <silent>             <Plug>NetrwCLeftmouse   
<leftmouse>:call <SID>NetrwCLeftmouse(0)<cr>
+    nno  <buffer> <silent>             <Plug>NetrwCLeftmouse   :exec "norm! 
\<lt>leftmouse>"<bar>call <SID>NetrwCLeftmouse(0)<cr>
     nmap <buffer> <s-leftmouse>                <Plug>NetrwSLeftmouse
-    nno  <buffer> <silent>             <Plug>NetrwSLeftmouse   
<leftmouse>:call <SID>NetrwSLeftmouse(0)<cr>
+    nno  <buffer> <silent>             <Plug>NetrwSLeftmouse   :exec "norm! 
\<lt>leftmouse>"<bar>call <SID>NetrwSLeftmouse(0)<cr>
     nmap <buffer> <s-leftdrag>         <Plug>NetrwSLeftdrag
-    nno  <buffer> <silent>             <Plug>NetrwSLeftdrag    
<leftmouse>:call <SID>NetrwSLeftdrag(0)<cr>
+    nno  <buffer> <silent>             <Plug>NetrwSLeftdrag    :exec "norm! 
\<lt>leftmouse>"<bar>call <SID>NetrwSLeftdrag(0)<cr>
     nmap <middlemouse>                 <Plug>NetrwMiddlemouse
-    nno  <buffer> <silent>             <middlemouse>           
<Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(0)<cr>
+    nno  <buffer> <silent>             <middlemouse>           
<Plug>NetrwMiddlemouse :exec "norm! \<lt>leftmouse>"<bar>call 
<SID>NetrwPrevWinOpen(0)<cr>
     nmap <buffer> <2-leftmouse>                <Plug>Netrw2Leftmouse
     nmap <buffer> <silent>             <Plug>Netrw2Leftmouse   -
     imap <buffer> <leftmouse>          <Plug>ILeftmouse
     imap <buffer> <middlemouse>                <Plug>IMiddlemouse
     imap <buffer> <s-leftmouse>                <Plug>ISLeftmouse
-    exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call 
<SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
-    exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call 
<SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
+    exe 'nnoremap <buffer> <silent> <rightmouse> :exec "norm! 
\<lt>leftmouse>"<bar>call 
<SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
+    exe 'vnoremap <buffer> <silent> <rightmouse> :exec "norm! 
\<lt>leftmouse>"<bar>call 
<SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
    endif
    exe 'nnoremap <buffer> <silent> <nowait> <del>      :call 
<SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
    exe 'nnoremap <buffer> <silent> <nowait> d          :call 
<SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>'

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1rUDf9-000Z1a-38%40256bit.org.

Raspunde prin e-mail lui