# HG changeset patch
# User Yuki KODAMA <endflow.net@gmail.com>
# Date 1251348480 -32400
# Branch stable
# Node ID 20641693fb58656dcabfeb1286b93979788e42eb
# Parent  08d901dc9e932b1a8ecc61dfa9d9769aeab0991c
status: fix regressions of patch text splitting

this bug was introduced at <703b33b310c9>
see also changeset <46f94acbaedd>

diff --git a/hggtk/status.py b/hggtk/status.py
--- a/hggtk/status.py
+++ b/hggtk/status.py
@@ -40,10 +40,10 @@
 def hunk_markup(text):
     'Format a diff hunk for display in a TreeView row with markup'
     hunk = ""
-    lines = text.splitlines()
+    # don't use splitlines, should split with only LF for the patch
+    lines = hglib.tounicode(text).split(u'\n')
     for line in lines:
-        line = gtklib.markup_escape_text(hglib.toutf(
-                    hglib.tounicode(line)[:512])) + '\n'
+        line = gtklib.markup_escape_text(hglib.toutf(line[:512])) + '\n'
         if line.startswith('---') or line.startswith('+++'):
             hunk += '<span foreground="#000090">%s</span>' % line
         elif line.startswith('-'):
@@ -59,10 +59,10 @@
 def hunk_unmarkup(text):
     'Format a diff hunk for display in a TreeView row without markup'
     hunk = ""
-    lines = text.splitlines()
+    # don't use splitlines, should split with only LF for the patch
+    lines = hglib.tounicode(text).split(u'\n')
     for line in lines:
-        hunk += gtklib.markup_escape_text(hglib.toutf(
-                    hglib.tounicode(line)[:512])) + '\n'
+        hunk += gtklib.markup_escape_text(hglib.toutf(line[:512])) + '\n'
     return hunk
 
 class GStatus(gdialog.GDialog):
