Show More
@@ -40,6 +40,7 b' def cell_preprocessor(function):' | |||||
40 | return nb, resources |
|
40 | return nb, resources | |
41 | return wrappedfunc |
|
41 | return wrappedfunc | |
42 |
|
42 | |||
|
43 | cr_pat = re.compile(r'.*\r(?=[^\n])') | |||
43 |
|
44 | |||
44 | @cell_preprocessor |
|
45 | @cell_preprocessor | |
45 | def coalesce_streams(cell, resources, index): |
|
46 | def coalesce_streams(cell, resources, index): | |
@@ -64,7 +65,6 b' def coalesce_streams(cell, resources, index):' | |||||
64 |
|
65 | |||
65 | last = outputs[0] |
|
66 | last = outputs[0] | |
66 | new_outputs = [last] |
|
67 | new_outputs = [last] | |
67 |
|
||||
68 | for output in outputs[1:]: |
|
68 | for output in outputs[1:]: | |
69 | if (output.output_type == 'stream' and |
|
69 | if (output.output_type == 'stream' and | |
70 | last.output_type == 'stream' and |
|
70 | last.output_type == 'stream' and | |
@@ -72,12 +72,14 b' def coalesce_streams(cell, resources, index):' | |||||
72 | ): |
|
72 | ): | |
73 | last.text += output.text |
|
73 | last.text += output.text | |
74 |
|
74 | |||
75 | # Respect \r characters. |
|
|||
76 | cr_pat = re.compile(r'.*\r(?=[^\n])') |
|
|||
77 | last.text = cr_pat.sub('', last.text) |
|
|||
78 | else: |
|
75 | else: | |
79 | new_outputs.append(output) |
|
76 | new_outputs.append(output) | |
80 | last = output |
|
77 | last = output | |
81 |
|
78 | |||
|
79 | # process \r characters | |||
|
80 | for output in new_outputs: | |||
|
81 | if output.output_type == 'stream': | |||
|
82 | output.text = cr_pat.sub('', output.text) | |||
|
83 | ||||
82 | cell.outputs = new_outputs |
|
84 | cell.outputs = new_outputs | |
83 | return cell, resources |
|
85 | return cell, resources |
General Comments 0
You need to be logged in to leave comments.
Login now