[meld] filediff: Check if chunk being highlighted is still valid (bgo#768298)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] filediff: Check if chunk being highlighted is still valid (bgo#768298)
- Date: Sun, 10 Jul 2016 00:54:28 +0000 (UTC)
commit a0a5a7ea9299b8aac60574be77afdf1b93a5409c
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Jul 10 10:49:04 2016 +1000
filediff: Check if chunk being highlighted is still valid (bgo#768298)
As described in the bug report, in some situations we can get a chunk
modification event (e.g., from a replacement) followed by a chunk
deletion event (e.g., because the chunks are now equal on both sides).
This messes with us because the deletion will clear the chunk
highlighting immediately, but when the modification results come
through asynchronously we just blindly add the highlighting, even
though this is no longer a change chunk.
With this patch, we check that the chunk we think we're highlighting
still exists before doing anything.
meld/filediff.py | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 1aaf675..098b676 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1278,12 +1278,17 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
self._prompt_long_highlighting()
continue
- def apply_highlight(bufs, tags, start_marks, end_marks, texts, matches):
+ def apply_highlight(
+ bufs, tags, start_marks, end_marks, texts, to_pane,
+ chunk, matches):
bufs[0].delete_mark(start_marks[0])
bufs[0].delete_mark(end_marks[0])
bufs[1].delete_mark(start_marks[1])
bufs[1].delete_mark(end_marks[1])
+ if not self.linediffer.has_chunk(to_pane, chunk):
+ return
+
starts = [bufs[0].get_iter_at_mark(start_marks[0]),
bufs[1].get_iter_at_mark(start_marks[1])]
ends = [bufs[0].get_iter_at_mark(end_marks[0]),
@@ -1331,8 +1336,9 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
bufs[1].create_mark(None, starts[1], True)]
ends = [bufs[0].create_mark(None, ends[0], True),
bufs[1].create_mark(None, ends[1], True)]
- match_cb = functools.partial(apply_highlight, bufs, tags,
- starts, ends, (text1, textn))
+ match_cb = functools.partial(
+ apply_highlight, bufs, tags, starts, ends, (text1, textn),
+ to_pane, c)
self._cached_match.match(text1, textn, match_cb)
self._cached_match.clean(self.linediffer.diff_count())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]