mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-17 19:20:56 +01:00
Correct new line numbers in diff viewer
With each new hunk, starting new line number was the same as starting old line number. Parse diff line a bit further to get real new line number. Fix HREFs for old line number links in both bootstrap3 and default themes so that thay work.
This commit is contained in:
@@ -169,9 +169,9 @@ class Repository extends BaseRepository
|
||||
switch ($log[0]) {
|
||||
case "@":
|
||||
// Set the line numbers
|
||||
preg_match('/@@ -([0-9]+)/', $log, $matches);
|
||||
preg_match('/@@ -([0-9]+),[0-9]+ \+([0-9]+)/', $log, $matches);
|
||||
$lineNumOld = $matches[1] - 1;
|
||||
$lineNumNew = $matches[1] - 1;
|
||||
$lineNumNew = $matches[2] - 1;
|
||||
break;
|
||||
case "-":
|
||||
$lineNumOld++;
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
<td class="lineNo">
|
||||
{% if line.getType != 'chunk' %}
|
||||
<a name="L{{ loop.index }}R{{ line.getNumOld }}"></a>
|
||||
<a href="#L{{ loop.index }}L{{ line.getNumOld }}">
|
||||
<a href="#L{{ loop.index }}R{{ line.getNumOld }}">
|
||||
{% endif %}
|
||||
{{ line.getNumOld }}
|
||||
{% if line.getType != 'chunk' %}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<td class="lineNo">
|
||||
{% if line.getType != 'chunk' %}
|
||||
<a name="L{{ loop.index }}R{{ line.getNumOld }}"></a>
|
||||
<a href="#L{{ loop.index }}L{{ line.getNumOld }}">
|
||||
<a href="#L{{ loop.index }}R{{ line.getNumOld }}">
|
||||
{% endif %}
|
||||
{{ line.getNumOld }}
|
||||
{% if line.getType != 'chunk' %}
|
||||
|
||||
Reference in New Issue
Block a user