mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-08 11:33:47 -05:00
Fix parsing of diff hunk headers with omitted length
7dd76231e6 made the comma and the second
number required in a line range. But they can be omitted, for example:
* Adding a single line file:
@@ -0,0 +1 @@
* Modifying a single line file:
@@ -1 +1 @@
This commit is contained in:
committed by
Tim Pope
parent
49cc58573e
commit
5b0b138483
@@ -7599,7 +7599,7 @@ function! s:HunkPosition(lnum) abort
|
||||
let lnum -= 1
|
||||
let line_char = getline(lnum)[0]
|
||||
endwhile
|
||||
let starts = matchlist(getline(lnum), '^@@\+[ 0-9,-]* -\(\d\+\),\d\+ +\(\d\+\),')
|
||||
let starts = matchlist(getline(lnum), '^@@\+[ 0-9,-]* -\(\d\+\)\%(,\d\+\)\= +\(\d\+\)[ ,]')
|
||||
if empty(starts)
|
||||
return [0, 0, 0]
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user