Skip to content
Snippets Groups Projects
Commit cf6b4f90 authored by Jerome Reybert's avatar Jerome Reybert
Browse files

Fix another escaping issue, with a global escape method ref #168

Another issue with escape problem. It was finally the same culprit.

match() function take a pattern as a paramter. If a:selection[0], the
hunk title, contains any regex special character, it goes wild.

It seems safer to escape with special character \V (very nomagic)
instead of adding regularly special characters to escape() function.
parent 16d9775d
No related branches found
No related tags found
No related merge requests found
...@@ -965,7 +965,7 @@ function! magit#stage_block(selection, discard) abort ...@@ -965,7 +965,7 @@ function! magit#stage_block(selection, discard) abort
" find current hunk position in file matching against current selection " find current hunk position in file matching against current selection
" header " header
try try
let hunk_id = match(map(deepcopy(file.get_hunks()), 'v:val.header'), escape(a:selection[0], '~*')) let hunk_id = match(map(deepcopy(file.get_hunks()), 'v:val.header'), "\\V" . a:selection[0])
catch /^Vim\%((\a\+)\)\=:E874/ catch /^Vim\%((\a\+)\)\=:E874/
echoerr "Escape issue with '" . a:selection[0] ."'" echoerr "Escape issue with '" . a:selection[0] ."'"
return return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment