# HG changeset patch # User Franz Glasner # Date 1541283233 -3600 # Node ID f3a4f1bc87add689aff933dae66fbd3a49a1483f # Parent bed05593eb8c657f874ecbe43efde4ac18abfcf9 Count physical lines within quoted strings also diff -r bed05593eb8c -r f3a4f1bc87ad extensions/timestamps.py --- a/extensions/timestamps.py Sat Nov 03 22:58:08 2018 +0100 +++ b/extensions/timestamps.py Sat Nov 03 23:13:53 2018 +0100 @@ -387,7 +387,7 @@ c = fp.read(1) record = [] field = [] - lineno = 1 + lineno = 1 # physical line number merge_block = '' while c: if c in '\r\n': @@ -439,6 +439,18 @@ # the next character will be read below: # just stay at the trailing `@' # + elif c2 in '\r\n': + if c2 == '\r': + # + # handle CR-LF ('\r\n') combination: skip a '\n' that + # follows directly + # + c3 = fp.peek(1) + if c3 and c3[0] == '\n': + fp.read(1) + lineno += 1 + sf.append('\n') + c2 = fp.read(1) else: sf.append(c2) c2 = fp.read(1)