changeset 171:cdf1c345ed2c

Handle CR-LF lineends w/o creating empty records
author Franz Glasner <hg@dom66.de>
date Sat, 01 Sep 2018 08:25:47 +0200
parents 0f34be604716
children 435395f13693
files extensions/timestamps.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/timestamps.py	Fri Aug 31 21:56:29 2018 +0200
+++ b/extensions/timestamps.py	Sat Sep 01 08:25:47 2018 +0200
@@ -230,6 +230,12 @@
             yield record
             record = []
             field = []
+            if c == '\r':
+                # handle CR-LF ('\r\n') combination
+                c3 = db.peek(1)
+                if c3 and c3[0] == '\n':
+                    # comsume it
+                    db.read(1)
         elif c == ' ':
             # field separator
             record.append(''.join(field))