Re: Inconsistent behaviour of BufferLines
- From: Piotr Piastucki <leech miranda gmail com>
- To: Kai Willadsen <kai willadsen gmail com>
- Cc: meld-list <meld-list gnome org>
- Subject: Re: Inconsistent behaviour of BufferLines
- Date: Mon, 09 Apr 2012 14:49:45 +0200
Hi,
The attached patch seems to fix the issues I spotted in BufferLines
behaviour so far. I tested it a bit and I did not notice any side
effects, however, more testing will be needed. And of course I agree it
is not a good idea to introduce such a change just before the 1.6
release. It may come in handy once the new cycle is started though.
Regards,
Piotr
>From 2ed9057bd04fbeadcd62b60aa6c95c808986e60d Mon Sep 17 00:00:00 2001
From: Piotr Piastucki <leech miranda gmail com>
Date: Sat, 7 Apr 2012 15:55:53 +0200
Subject: [PATCH 3/3] Fix inconsistent behaviour of BufferLines
---
meld/filediff.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/meld/filediff.py b/meld/filediff.py
index b3bedbf..2c1f405 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -110,7 +110,7 @@ class BufferLines(object):
# newline. As splitlines() discards an empty line at the end, we need
# to artificially add a line if the requested slice is past the end of
# the buffer, and the last line in the slice ended in a newline.
- if hi >= self.buf.get_line_count() and \
+ if hi >= self.buf.get_line_count() and lo < self.buf.get_line_count() and \
(len(lines) == 0 or len(lines[-1]) != len(ends[-1])):
lines.append(u"")
ends.append(u"")
@@ -135,7 +135,7 @@ class BufferLines(object):
return lines
def __getitem__(self, i):
- if i > len(self):
+ if i >= len(self):
raise IndexError
line_start = get_iter_at_line_or_eof(self.buf, i)
line_end = line_start.copy()
--
1.7.5.4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]