[meld/meld-3-12] meldbuffer: Fix splitlines hack for multiple line ends (bgo#743301)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld/meld-3-12] meldbuffer: Fix splitlines hack for multiple line ends (bgo#743301)
- Date: Fri, 23 Jan 2015 22:48:27 +0000 (UTC)
commit e21e25c63b9541821eb2acae356d327b9cc92112
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Jan 24 08:42:28 2015 +1000
meldbuffer: Fix splitlines hack for multiple line ends (bgo#743301)
The hack this fixes exists because Python's splitlines() splits on a
few characters that GTK+'s text handling doesn't. The hack 'correctly'
handles this case as long as there's only one of these characters in
a line, but in files with e.g., multiple 0x0c characters on a single
line, it broke.
This change fixes the problem by not moving off a line until we go
through without performing any of our 'fixes' to it.
meld/meldbuffer.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/meld/meldbuffer.py b/meld/meldbuffer.py
index 1ba2bb2..c1648f7 100644
--- a/meld/meldbuffer.py
+++ b/meld/meldbuffer.py
@@ -243,7 +243,11 @@ class BufferLines(object):
assert len(ends) >= i + 1
lines[i:i + 2] = [line + end[-1] + lines[i + 1]]
ends[i:i + 2] = [end + ends[i + 1]]
- i += 1
+ else:
+ # We only increment if we don't correct a line, to
+ # handle the case of a single line having multiple
+ # additional_breaks characters that need correcting.
+ i += 1
return lines
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]