0
0
mirror of https://github.com/vim/vim.git synced 2025-09-06 21:53:38 -04:00

runtime(netrw): delete confirmation not strict enough

fixes: #15680

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt 2024-09-15 19:17:23 +02:00
parent 59149f0269
commit 0f5effbd1f
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -23,6 +23,7 @@
" 2024 Aug 15 by Vim Project: style changes, prevent E121 (#15501) " 2024 Aug 15 by Vim Project: style changes, prevent E121 (#15501)
" 2024 Aug 22 by Vim Project: fix mf-selection highlight (#15551) " 2024 Aug 22 by Vim Project: fix mf-selection highlight (#15551)
" 2024 Aug 22 by Vim Project: adjust echo output of mx command (#15550) " 2024 Aug 22 by Vim Project: adjust echo output of mx command (#15550)
" 2024 Sep 15 by Vim Project: more strict confirmation dialog (#15680)
" }}} " }}}
" Former Maintainer: Charles E Campbell " Former Maintainer: Charles E Campbell
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
@ -11388,7 +11389,7 @@ fun! s:NetrwLocalRm(path) range
let ok= s:NetrwLocalRmFile(a:path,fname,all) let ok= s:NetrwLocalRmFile(a:path,fname,all)
if ok =~# 'q\%[uit]' || ok == "no" if ok =~# 'q\%[uit]' || ok == "no"
break break
elseif ok =~# 'a\%[ll]' elseif ok =~# '^a\%[ll]$'
let all= 1 let all= 1
endif endif
endfor endfor
@ -11417,7 +11418,7 @@ fun! s:NetrwLocalRm(path) range
let ok= s:NetrwLocalRmFile(a:path,curword,all) let ok= s:NetrwLocalRmFile(a:path,curword,all)
if ok =~# 'q\%[uit]' || ok == "no" if ok =~# 'q\%[uit]' || ok == "no"
break break
elseif ok =~# 'a\%[ll]' elseif ok =~# '^a\%[ll]$'
let all= 1 let all= 1
endif endif
let ctr= ctr + 1 let ctr= ctr + 1
@ -11464,12 +11465,12 @@ fun! s:NetrwLocalRmFile(path,fname,all)
" call Decho("response: ok<".ok.">",'~'.expand("<slnum>")) " call Decho("response: ok<".ok.">",'~'.expand("<slnum>"))
let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
" call Decho("response: ok<".ok."> (after sub)",'~'.expand("<slnum>")) " call Decho("response: ok<".ok."> (after sub)",'~'.expand("<slnum>"))
if ok =~# 'a\%[ll]' if ok =~# '^a\%[ll]$'
let all= 1 let all= 1
endif endif
endif endif
if all || ok =~# 'y\%[es]' || ok == "" if all || ok =~# '^y\%[es]$' || ok == ""
let ret= s:NetrwDelete(rmfile) let ret= s:NetrwDelete(rmfile)
" call Decho("errcode=".v:shell_error." ret=".ret,'~'.expand("<slnum>")) " call Decho("errcode=".v:shell_error." ret=".ret,'~'.expand("<slnum>"))
endif endif
@ -11485,13 +11486,13 @@ fun! s:NetrwLocalRmFile(path,fname,all)
if ok == "" if ok == ""
let ok="no" let ok="no"
endif endif
if ok =~# 'a\%[ll]' if ok =~# '^a\%[ll]$'
let all= 1 let all= 1
endif endif
endif endif
let rmfile= substitute(rmfile,'[\/]$','','e') let rmfile= substitute(rmfile,'[\/]$','','e')
if all || ok =~# 'y\%[es]' || ok == "" if all || ok =~# '^y\%[es]$' || ok == ""
if delete(rmfile,"rf") if delete(rmfile,"rf")
call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".rmfile.">!",103) call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".rmfile.">!",103)
endif endif