[gitg] Calculate offsets correctly
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Calculate offsets correctly
- Date: Thu, 2 Jan 2014 12:41:53 +0000 (UTC)
commit afcc6e6abc12e965228e727f6a3e95a51d61e368
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Thu Jan 2 13:29:10 2014 +0100
Calculate offsets correctly
libgitg/resources/diff-view.js | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/libgitg/resources/diff-view.js b/libgitg/resources/diff-view.js
index 191a2a6..cb0a9db 100644
--- a/libgitg/resources/diff-view.js
+++ b/libgitg/resources/diff-view.js
@@ -185,7 +185,6 @@ function prepare_patchset(filediv)
elem = next_element(elem);
var patches = [];
-
var doffset = 0;
var a = "a".charCodeAt(0);
@@ -220,13 +219,24 @@ function prepare_patchset(filediv)
}
else
{
+ var o = {old: offset, new: offset};
+
+ if (added)
+ {
+ o.old -= doffset;
+ }
+ else
+ {
+ o.new += doffset;
+ }
+
// [sign, old_offset, new_offset, length]
- last = [tp, offset + doffset, offset, length];
+ last = [tp, o.old, o.new, length];
patches.push(last);
}
}
- doffset += added ? -length : length;
+ doffset += added ? length : -length;
}
var filename = filediv.getAttribute('data-filename');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]