Index: filediff.py
===================================================================
--- filediff.py	(Revision 1183)
+++ filediff.py	(Arbeitskopie)
@@ -1046,11 +1046,11 @@
                 "insert":solid_green,
                 "replace":solid_blue,
                 "delete":solid_green}
-        for c in self.linediffer.single_changes(scrollindex, self._get_texts()):
+        texts = self._get_texts()
+        for c in self.linediffer.single_changes(scrollindex, texts):
             assert c[0] != "equal"
-            if self.prefs.ignore_blank_lines:
-                c1,c2 = self._consume_blank_lines( self._get_texts()[scrollindex][c[1]:c[2]] )
-            rect(context, ctab[c[0]], scale*c[1], scale*c[2])
+            if not self._is_ignored(c, texts[scrollindex], texts[c[5]]):
+                rect(context, ctab[c[0]], scale*c[1], scale*c[2])
 
     def _get_line_count(self, index):
         """Return the number of lines in the buffer of textview 'text'"""
@@ -1090,25 +1090,26 @@
         if jump_to_first:
             # curline already has some positive value due to scrollbar size
             curline = -1
-        c = None
+        found = None
+        texts = self._get_texts()
         if direction == gdk.SCROLL_DOWN:
-            for c in self.linediffer.single_changes(1, self._get_texts()):
+            for c in self.linediffer.single_changes(1, texts):
                 assert c[0] != "equal"
-                c1,c2 = self._consume_blank_lines( self._get_texts()[1][c[1]:c[2]] )
-                if c[1]+c1 == c[2]-c2:
+                if self._is_ignored(c, texts[1], texts[c[5]]):
                     continue
                 if c[1] > curline + 1:
+                    found = c
                     break
         else: #direction == gdk.SCROLL_UP
-            for chunk in self.linediffer.single_changes(1, self._get_texts()):
-                c1,c2 = self._consume_blank_lines( self._get_texts()[1][chunk[1]:chunk[2]] )
-                if chunk[1]+c1 == chunk[2]-c2:
+            for c in self.linediffer.single_changes(1, texts):
+                if self._is_ignored(c, texts[1], texts[c[5]]):
                     continue
-                if chunk[2] < curline:
-                    c = chunk
-                elif c:
+                if c[2] < curline:
+                    found = c
+                elif found:
                     break
-        if c:
+        if found:
+            c = found
             if c[2] - c[1]: # no range, use other side
                 l0,l1 = c[1],c[2]
                 aidx = 1
@@ -1121,20 +1122,15 @@
             want = misc.clamp(want, 0, a.upper-a.page_size)
             a.set_value( want )
 
-    def _consume_blank_lines(self, txt):
-        lo, hi = 0, 0
-        for l in txt:
-            if len(l)==0:
-                lo += 1
-            else:
-                break
-        for l in txt[lo:]:
-            if len(l)==0:
-                hi += 1
-            else:
-                break
-        return lo,hi
 
+    def _is_ignored(self, c, txt1, txt2):
+        if not self.prefs.ignore_blank_lines:
+            return False
+        for line in txt1[c[1]:c[2]] + txt2[c[3]:c[4]]:
+            if line.strip():
+                return False
+        return True
+
         #
         # linkmap drawing
         #
@@ -1173,13 +1169,10 @@
             context.paint()
             context.identity_matrix()
 
-        for c in self.linediffer.pair_changes(which, which+1, self._get_texts()):
-            if self.prefs.ignore_blank_lines:
-                c1,c2 = self._consume_blank_lines( self._get_texts()[which  ][c[1]:c[2]] )
-                c3,c4 = self._consume_blank_lines( self._get_texts()[which+1][c[3]:c[4]] )
-                c = c[0], c[1]+c1,c[2]-c2, c[3]+c3,c[4]-c4
-                if c[1]==c[2] and c[3]==c[4]:
-                    continue
+        texts = self._get_texts()
+        for c in self.linediffer.pair_changes(which, which+1, texts):
+            if self._is_ignored(c, texts[which], texts[which+1]):
+                continue
 
             assert c[0] != "equal"
             if c[2] < visible[1] and c[4] < visible[3]: # find first visible chunk
@@ -1260,13 +1253,10 @@
             adj = self.scrolledwindow[src].get_vadjustment()
             func = lambda c: self._line_to_pixel(src, c[1]) - adj.value
 
-            for c in self.linediffer.pair_changes(src, dst, self._get_texts()):
-                if self.prefs.ignore_blank_lines:
-                    c1,c2 = self._consume_blank_lines( self._get_texts()[src][c[1]:c[2]] )
-                    c3,c4 = self._consume_blank_lines( self._get_texts()[dst][c[3]:c[4]] )
-                    c = c[0], c[1]+c1,c[2]-c2, c[3]+c3,c[4]-c4
-                    if c[1]==c[2] and c[3]==c[4]:
-                        continue
+            texts = self._get_texts()
+            for c in self.linediffer.pair_changes(src, dst, texts):
+                if self._is_ignored(c, texts[src], texts[dst]):
+                    continue
                 if c[0] == "insert":
                     continue
                 h = func(c)
