#print(text)
prefix = lines[0][:j]
for j in range(len(lines)):
- if len(lines[j]) == 0:
- lines[j] = '\n'
- else:
- assert lines[j][:len(prefix)] == prefix
- lines[j] = '{0:s}{1:s}\n'.format(indent, lines[j][len(prefix):])
+ assert lines[j][:len(prefix)] == prefix[:len(lines[j])]
+ lines[j] = (
+ '\n'
+ if len(lines[j]) <= len(prefix) else
+ '{0:s}{1:s}\n'.format(indent, lines[j][len(prefix):])
+ )
return ''.join(lines)
# note: these routines are literally the same, but conceptually different,