Show More
@@ -61,11 +61,11 b' var IPython = (function (IPython) {' | |||
|
61 | 61 | // handlers and is used to provide custom key handling. Its return |
|
62 | 62 | // value is used to determine if CodeMirror should ignore the event: |
|
63 | 63 | // true = ignore, false = don't ignore. |
|
64 | ||
|
64 | ||
|
65 | 65 | if (this.read_only){ |
|
66 | 66 | return false; |
|
67 | 67 | } |
|
68 | ||
|
68 | ||
|
69 | 69 | var that = this; |
|
70 | 70 | // whatever key is pressed, first, cancel the tooltip request before |
|
71 | 71 | // they are sent, and remove tooltip if any, except for tab again |
@@ -90,7 +90,7 b' var IPython = (function (IPython) {' | |||
|
90 | 90 | event.stop(); |
|
91 | 91 | return false; |
|
92 | 92 | } else { |
|
93 |
return true; |
|
|
93 | return true; | |
|
94 | 94 | }; |
|
95 | 95 | } else if (event.which === key.ESC) { |
|
96 | 96 | IPython.tooltip.remove_and_cancel_tooltip(true); |
@@ -102,7 +102,7 b' var IPython = (function (IPython) {' | |||
|
102 | 102 | event.stop(); |
|
103 | 103 | return false; |
|
104 | 104 | } else { |
|
105 |
return true; |
|
|
105 | return true; | |
|
106 | 106 | }; |
|
107 | 107 | } else if (event.keyCode === key.TAB && event.type == 'keydown') { |
|
108 | 108 | // Tab completion. |
@@ -181,11 +181,7 b' var IPython = (function (IPython) {' | |||
|
181 | 181 | if (json.stream == undefined){ |
|
182 | 182 | json.stream = 'stdout'; |
|
183 | 183 | } |
|
184 |
|
|
|
185 | // fixConsole gives nothing (empty string, \r, etc.) | |
|
186 | // so don't append any elements, which might add undesirable space | |
|
187 | return; | |
|
188 | } | |
|
184 | var text = utils.fixConsole(json.text); | |
|
189 | 185 | var subclass = "output_"+json.stream; |
|
190 | 186 | if (this.outputs.length > 0){ |
|
191 | 187 | // have at least one output to consider |
@@ -194,15 +190,23 b' var IPython = (function (IPython) {' | |||
|
194 | 190 | // latest output was in the same stream, |
|
195 | 191 | // so append directly into its pre tag |
|
196 | 192 | // escape ANSI & HTML specials: |
|
197 | var text = utils.fixConsole(json.text); | |
|
198 | this.element.find('div.'+subclass).last().find('pre').append(text); | |
|
193 | pre = this.element.find('div.'+subclass).last().find('pre'); | |
|
194 | html = utils.fixCarriageReturn( | |
|
195 | pre.html() + utils.fixConsole(text)); | |
|
196 | pre.html(html); | |
|
199 | 197 | return; |
|
200 | 198 | } |
|
201 | 199 | } |
|
202 | ||
|
200 | ||
|
201 | if (!text.replace("\r", "")) { | |
|
202 | // text is nothing (empty string, \r, etc.) | |
|
203 | // so don't append any elements, which might add undesirable space | |
|
204 | return; | |
|
205 | } | |
|
206 | ||
|
203 | 207 | // If we got here, attach a new div |
|
204 | 208 | var toinsert = this.create_output_area(); |
|
205 |
this.append_text( |
|
|
209 | this.append_text(text, toinsert, "output_stream "+subclass); | |
|
206 | 210 | this.element.append(toinsert); |
|
207 | 211 | }; |
|
208 | 212 | |
@@ -260,6 +264,7 b' var IPython = (function (IPython) {' | |||
|
260 | 264 | var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_text"); |
|
261 | 265 | // escape ANSI & HTML specials in plaintext: |
|
262 | 266 | data = utils.fixConsole(data); |
|
267 | data = utils.fixCarriageReturn(data); | |
|
263 | 268 | if (extra_class){ |
|
264 | 269 | toinsert.addClass(extra_class); |
|
265 | 270 | } |
@@ -328,7 +333,7 b' var IPython = (function (IPython) {' | |||
|
328 | 333 | |
|
329 | 334 | OutputArea.prototype.clear_output_callback = function (stdout, stderr, other) { |
|
330 | 335 | var output_div = this.element; |
|
331 | ||
|
336 | ||
|
332 | 337 | if (stdout && stderr && other){ |
|
333 | 338 | // clear all, no need for logic |
|
334 | 339 | output_div.html(""); |
@@ -347,7 +352,7 b' var IPython = (function (IPython) {' | |||
|
347 | 352 | if (other) { |
|
348 | 353 | output_div.find("div.output_subarea").not("div.output_stderr").not("div.output_stdout").parent().remove(); |
|
349 | 354 | } |
|
350 | ||
|
355 | ||
|
351 | 356 | // remove cleared outputs from JSON list: |
|
352 | 357 | for (var i = this.outputs.length - 1; i >= 0; i--) { |
|
353 | 358 | var out = this.outputs[i]; |
@@ -117,7 +117,7 b' var IPython = (function (IPython) {' | |||
|
117 | 117 | |
|
118 | 118 | Pager.prototype.append_text = function (text) { |
|
119 | 119 | var toinsert = $("<div/>").addClass("output_area output_stream"); |
|
120 | toinsert.append($('<pre/>').html(utils.fixConsole(text))); | |
|
120 | toinsert.append($('<pre/>').html(utils.fixCarriageReturn(utils.fixConsole(text)))); | |
|
121 | 121 | this.pager_element.append(toinsert); |
|
122 | 122 | }; |
|
123 | 123 |
@@ -47,7 +47,7 b' IPython.utils = (function (IPython) {' | |||
|
47 | 47 | "37":"ansigrey", "01":"ansibold" |
|
48 | 48 | }; |
|
49 | 49 | |
|
50 | // Transform ANI color escape codes into HTML <span> tags with css | |
|
50 | // Transform ANSI color escape codes into HTML <span> tags with css | |
|
51 | 51 | // classes listed in the above ansi_colormap object. The actual color used |
|
52 | 52 | // are set in the css file. |
|
53 | 53 | function fixConsole(txt) { |
@@ -58,7 +58,6 b' IPython.utils = (function (IPython) {' | |||
|
58 | 58 | var opener = ""; |
|
59 | 59 | var closer = ""; |
|
60 | 60 | // \r does nothing, so shouldn't be included |
|
61 | txt = txt.replace('\r', ''); | |
|
62 | 61 | while (re.test(txt)) { |
|
63 | 62 | var cmds = txt.match(re)[1].split(";"); |
|
64 | 63 | closer = opened?"</span>":""; |
@@ -133,6 +132,7 b' IPython.utils = (function (IPython) {' | |||
|
133 | 132 | fixConsole : fixConsole, |
|
134 | 133 | keycodes : keycodes, |
|
135 | 134 | grow : grow, |
|
135 | fixCarriageReturn : fixCarriageReturn | |
|
136 | 136 | }; |
|
137 | 137 | |
|
138 | 138 | }(IPython)); |
General Comments 0
You need to be logged in to leave comments.
Login now