[meld] Bring back merge arrows in conflict blocks (closes bgo#602871)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Bring back merge arrows in conflict blocks (closes bgo#602871)
- Date: Mon, 1 Mar 2010 08:16:37 +0000 (UTC)
commit 4e3a717a6c4f97a17b9bae03f7f0618a170ade3c
Author: Kai Willadsen <kai willadsen gmail com>
Date: Mon Feb 15 10:59:11 2010 +1000
Bring back merge arrows in conflict blocks (closes bgo#602871)
In the 1.2.x series, Meld had arrows for conflict blocks. However, with
recent improvements to the conflict detection and separation, these arrows
got lost, and no longer made sense. For example, with the new conflict
detection, we can have one block of a conflict be empty; it makes no sense
to use a normal 'replace' arrow for an empty block.
This commit passes around some extra information to enable the drawing and
processing to do sensible things for conflict blocks.
meld/filediff.py | 10 ++++++----
meld/filemerge.py | 8 ++++----
2 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 978d6ad..e5e8140 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1188,9 +1188,11 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
else: # self.keymask == 0:
pix0 = self.pixbuf_apply0
pix1 = self.pixbuf_apply1
- if change in ("insert", "replace"):
+ if change[0] in ("insert", "replace") or (change[0] == "conflict" and
+ change[3] - change[4] != 0):
self.paint_pixbuf_at(context, pix1, x, t0)
- if change in ("delete", "replace"):
+ if change[0] in ("delete", "replace") or (change[0] == "conflict" and
+ change[1] - change[2] != 0):
self.paint_pixbuf_at(context, pix0, 0, f0)
#
@@ -1248,7 +1250,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
context.stroke()
x = wtotal-self.pixbuf_apply0.get_width()
- self._linkmap_draw_icon(context, which, c[0], x, f0, t0)
+ self._linkmap_draw_icon(context, which, c, x, f0, t0)
# allow for scrollbar at end of textview
mid = int(0.5 * self.textview[0].allocation.height) + 0.5
@@ -1268,7 +1270,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
adj = self.scrolledwindow[src].get_vadjustment()
for c in self.linediffer.pair_changes(src, dst):
- if c[0] == "insert":
+ if c[0] == "insert" or (c[0] == "conflict" and c[1] - c[2] == 0):
continue
h = self._line_to_pixel(src, c[1]) - adj.value + rel_offset
if h < 0: # find first visible chunk
diff --git a/meld/filemerge.py b/meld/filemerge.py
index ff6a8f9..f6ef329 100644
--- a/meld/filemerge.py
+++ b/meld/filemerge.py
@@ -97,14 +97,14 @@ class FileMerge(filediff.FileDiff):
pix1 = self.pixbuf_apply0
if which:
- if change in ("delete"):
+ if change[0] in ("delete"):
self.paint_pixbuf_at(context, pix0, 0, f0)
- if change in ("insert", "replace", "conflict"):
+ if change[0] in ("insert", "replace", "conflict"):
self.paint_pixbuf_at(context, pix1, x, t0)
else:
- if change in ("insert"):
+ if change[0] in ("insert"):
self.paint_pixbuf_at(context, pix0, x, t0)
- if change in ("delete", "replace", "conflict"):
+ if change[0] in ("delete", "replace", "conflict"):
self.paint_pixbuf_at(context, pix1, 0, f0)
def _linkmap_process_event(self, event, which, side, htotal, rect_x, pix_width, pix_height):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]