runtime(netrw): NetrwChgPerm for files not in cwd

Commit: 
https://github.com/vim/vim/commit/fe71c56d8fb6b5a51d1f7f6d54d658ef17a98713
Author: Mohammad Reza Karimi <[email protected]>
Date:   Sat Nov 1 15:46:04 2025 +0000

    runtime(netrw): NetrwChgPerm for files not in cwd
    
    Problem:  Changing permissions fail when using `gp` if the file under
              the cursor is not in the current working directory.
    Solution: Use the already available `a:curdir` argument and prepend it
              to the `<cfile>`, so that the path of the file is correct.
    
    This commit also refactors some leftover `netrw#ErrorMsg` to
    `netrw#msg#Notify` (the main refactoring was done in
    f5e3b5c04f85b0f69cd2aae81e4938cfb191a790).
    
    closes: #18674
    
    Signed-off-by: Mohammad Reza Karimi <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/pack/dist/opt/netrw/autoload/netrw.vim 
b/runtime/pack/dist/opt/netrw/autoload/netrw.vim
index 37adbf920..dcf8a365f 100644
--- a/runtime/pack/dist/opt/netrw/autoload/netrw.vim
+++ b/runtime/pack/dist/opt/netrw/autoload/netrw.vim
@@ -12,6 +12,7 @@
 " 2025 Oct 01 by Vim Project fix navigate to parent folder #18464
 " 2025 Oct 26 by Vim Project fix parsing of remote user names #18611
 " 2025 Oct 27 by Vim Project align comment after #18611
+" 2025 Nov 01 by Vim Project fix NetrwChgPerm #18674
 " 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
@@ -4211,11 +4212,12 @@ function s:NetrwChgPerm(islocal,curdir)
     call inputsave()
     let newperm= input("Enter new permission: ")
     call inputrestore()
-    let chgperm= 
substitute(g:netrw_chgperm,'\<FILENAME\>',netrw#os#Escape(expand("<cfile>")),'')
+    let fullpath = fnamemodify(netrw#fs#PathJoin(a:curdir, expand("<cfile>")), 
':p')
+    let chgperm= 
substitute(g:netrw_chgperm,'\<FILENAME\>',netrw#os#Escape(fullpath),'')
     let chgperm= substitute(chgperm,'\<PERM\>',netrw#os#Escape(newperm),'')
     call system(chgperm)
     if v:shell_error != 0
-        NetrwKeepj call netrw#ErrorMsg(1,"changing permission on 
file<".expand("<cfile>")."> seems to have failed",75)
+        NetrwKeepj call netrw#msg#Notify('WARNING', printf('changing 
permission on file<%s> seems to have failed', fullpath))
     endif
     if a:islocal
         NetrwKeepj call 
s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./',0))
@@ -4591,7 +4593,7 @@ function s:NetrwServerEdit(islocal,fname)
         endif
 
     else
-        call netrw#ErrorMsg(s:ERROR,"you need a gui-capable vim and 
client-server to use <ctrl-r>",98)
+        call netrw#msg#Notify('ERROR', 'you need a gui-capable vim and 
client-server to use <ctrl-r>')
     endif
 
 endfunction

-- 
-- 
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 visit 
https://groups.google.com/d/msgid/vim_dev/E1vGlld-006kLH-85%40256bit.org.

Raspunde prin e-mail lui