Show More
@@ -66,7 +66,21 b' def coalesce_streams(cell, resources, index):' | |||||
66 | last.output_type == 'stream' and |
|
66 | last.output_type == 'stream' and | |
67 | last.stream == output.stream |
|
67 | last.stream == output.stream | |
68 | ): |
|
68 | ): | |
69 | last.text += output.text |
|
69 | # Either append this output to the existing or replace the last line | |
|
70 | # of the existing if a \r character is found. | |||
|
71 | if '\r' in output.text: | |||
|
72 | existing_lines = last.text.split('\n') | |||
|
73 | new_pieces = output.text.split('\r') | |||
|
74 | # If there is any text preceding the first occurance of '\r', it | |||
|
75 | # is appended as a new line to the lines. | |||
|
76 | if len(new_pieces[0]) > 0: | |||
|
77 | existing_lines.append(new_pieces[0]) | |||
|
78 | # The text following the last occurance of '\r' replaces the | |||
|
79 | # last line of text in the output. | |||
|
80 | existing_lines[-1] = new_pieces[-1] | |||
|
81 | last.text = '\n'.join(existing_lines) | |||
|
82 | else: | |||
|
83 | last.text += output.text | |||
70 | else: |
|
84 | else: | |
71 | new_outputs.append(output) |
|
85 | new_outputs.append(output) | |
72 | last = output |
|
86 | last = output |
General Comments 0
You need to be logged in to leave comments.
Login now