[meld] Inline and simplify _find_blank_lines
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Inline and simplify _find_blank_lines
- Date: Fri, 13 Jul 2012 23:03:19 +0000 (UTC)
commit 9f4c733a1958944ebd2611fbc12ffbba40a0df30
Author: Kai Willadsen <kai willadsen gmail com>
Date: Wed Jun 20 07:00:33 2012 +1000
Inline and simplify _find_blank_lines
meld/diffutil.py | 23 ++++++++++-------------
1 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/meld/diffutil.py b/meld/diffutil.py
index 517afce..ffeafa8 100644
--- a/meld/diffutil.py
+++ b/meld/diffutil.py
@@ -176,9 +176,17 @@ class Differ(gobject.GObject):
if c is None:
return None
+ def _find_blank_lines(txt, lo, hi):
+ while not txt[lo] and lo < hi:
+ lo += 1
+ while not txt[hi - 1] and lo < hi:
+ hi -= 1
+ return lo, hi
+
tag = c.tag
- c1, c2 = self._find_blank_lines(texts[pane1], c[1], c[2])
- c3, c4 = self._find_blank_lines(texts[pane2], c[3], c[4])
+ c1, c2 = _find_blank_lines(texts[pane1], c[1], c[2])
+ c3, c4 = _find_blank_lines(texts[pane2], c[3], c[4])
+
if c1 == c2 and c3 == c4:
return None
if c1 == c2 and tag == "replace":
@@ -187,17 +195,6 @@ class Differ(gobject.GObject):
c0 = "delete"
return DiffChunk._make((tag, c1, c2, c3, c4))
- def _find_blank_lines(self, txt, lo, hi):
- for line in range(lo, hi):
- if txt[line]:
- break
- lo += 1
- for line in range(hi, lo, -1):
- if txt[line - 1]:
- break
- hi -= 1
- return lo, hi
-
def change_sequence(self, sequence, startidx, sizechange, texts):
assert sequence in (0, 1, 2)
if sequence == 0 or sequence == 1:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]