mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-10-30 06:10:44 +00:00
Calculate offsets correctly
This commit is contained in:
parent
e327c0fa62
commit
afcc6e6abc
1 changed files with 13 additions and 3 deletions
|
@ -185,7 +185,6 @@ function prepare_patchset(filediv)
|
||||||
elem = next_element(elem);
|
elem = next_element(elem);
|
||||||
|
|
||||||
var patches = [];
|
var patches = [];
|
||||||
|
|
||||||
var doffset = 0;
|
var doffset = 0;
|
||||||
|
|
||||||
var a = "a".charCodeAt(0);
|
var a = "a".charCodeAt(0);
|
||||||
|
@ -220,13 +219,24 @@ function prepare_patchset(filediv)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
var o = {old: offset, new: offset};
|
||||||
|
|
||||||
|
if (added)
|
||||||
|
{
|
||||||
|
o.old -= doffset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
o.new += doffset;
|
||||||
|
}
|
||||||
|
|
||||||
// [sign, old_offset, new_offset, length]
|
// [sign, old_offset, new_offset, length]
|
||||||
last = [tp, offset + doffset, offset, length];
|
last = [tp, o.old, o.new, length];
|
||||||
patches.push(last);
|
patches.push(last);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doffset += added ? -length : length;
|
doffset += added ? length : -length;
|
||||||
}
|
}
|
||||||
|
|
||||||
var filename = filediv.getAttribute('data-filename');
|
var filename = filediv.getAttribute('data-filename');
|
||||||
|
|
Loading…
Reference in a new issue