change filter regex for diff output

Diff output of files containing conflict markers start with '@@@'
opposed to 'normal' diff output with only '@@'.

I'm not sure if files with conflict markers should be handled by Sy, so
these lines get just ignored for now.

I'll add it to my TODO nevertheless.

Closes #16.
This commit is contained in:
Marco Hinz 2013-04-02 20:09:05 +02:00
parent 91a277dd92
commit f6f6f90542

View File

@ -301,7 +301,7 @@ endfunction
" Function: s:repo_process_diff {{{1
function! s:repo_process_diff(path, diff) abort
" Determine where we have to put our signs.
for line in filter(split(a:diff, '\n'), 'v:val =~ "^@@"')
for line in filter(split(a:diff, '\n'), 'v:val =~ "^@@ "')
let tokens = matchlist(line, '^@@ -\v(\d+),?(\d*) \+(\d+),?(\d*)')
let [ old_line, old_count, new_line, new_count ] = [ str2nr(tokens[1]), empty(tokens[2]) ? 1 : str2nr(tokens[2]), str2nr(tokens[3]), empty(tokens[4]) ? 1 : str2nr(tokens[4]) ]