Commit aea5e8a1 authored by Michael Murtaugh's avatar Michael Murtaugh

added inserchars

parent 5c2767a0
......@@ -94,6 +94,7 @@ def perform_changeset_curline (text, c):
textpos = 0
curline = 0
curline_charpos = 0
curline_insertchars = 0
bank = c['bank']
bankpos = 0
newtext = ''
......@@ -114,6 +115,7 @@ def perform_changeset_curline (text, c):
curline_charpos = 0
else:
curline_charpos += op['chars']
curline_insertchars = op['chars']
# todo PROCESS attributes
# NB on insert, the (original/old/previous) textpos does *not* increment...
elif op['op'] == "delete":
......@@ -132,7 +134,7 @@ def perform_changeset_curline (text, c):
# append rest of old text...
newtext += text[textpos:]
return newtext, curline, curline_charpos
return newtext, curline, curline_charpos, curline_insertchars
if __name__ == "__main__":
import sys
......@@ -152,7 +154,7 @@ if __name__ == "__main__":
for r in range(0, last_rev+1):
d = data["pad:{0}:revs:{1}".format(padname, r)]
cs = changeset_parse(d['changeset'])
text, linepos, charpos = perform_changeset_curline(text, cs)
text, linepos, charpos, inserts = perform_changeset_curline(text, cs)
lines = text.splitlines()
if charpos == 0 and linepos > 0:
line = lines[linepos-1]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment