Skip to content

Commit

Permalink
Merge pull request #182 from frederikhermans/master
Browse files Browse the repository at this point in the history
Properly render newlines etc. in raw_input() prompt
  • Loading branch information
minrk committed Jul 4, 2015
2 parents b79c6ad + 7c119ca commit e8b3c17
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
32 changes: 16 additions & 16 deletions notebook/static/notebook/js/outputarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -774,23 +774,23 @@ define([
$("<div/>")
.addClass("box-flex1 output_subarea raw_input_container")
.append(
$("<span/>")
$("<pre/>")
.addClass("raw_input_prompt")
.text(content.prompt)
)
.append(
$("<input/>")
.addClass("raw_input")
.attr('type', input_type)
.attr("size", 47)
.keydown(function (event, ui) {
// make sure we submit on enter,
// and don't re-execute the *cell* on shift-enter
if (event.which === keyboard.keycodes.enter) {
that._submit_raw_input();
return false;
}
})
.append(
$("<input/>")
.addClass("raw_input")
.attr('type', input_type)
.attr("size", 47)
.keydown(function (event, ui) {
// make sure we submit on enter,
// and don't re-execute the *cell* on shift-enter
if (event.which === keyboard.keycodes.enter) {
that._submit_raw_input();
return false;
}
})
)
)
);

Expand All @@ -807,7 +807,7 @@ define([

OutputArea.prototype._submit_raw_input = function (evt) {
var container = this.element.find("div.raw_input_container");
var theprompt = container.find("span.raw_input_prompt");
var theprompt = container.find("pre.raw_input_prompt");
var theinput = container.find("input.raw_input");
var value = theinput.val();
var echo = value;
Expand Down
8 changes: 4 additions & 4 deletions notebook/static/notebook/less/outputarea.less
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,18 @@ div.output_javascript:empty {
/* raw_input styles */

div.raw_input_container {
font-family: @font-family-monospace;
line-height: @code_line_height;
// for some reason, em padding doesn't compute the same for raw_input
// that is not the first input, but px does
padding-top: 5px;
}

span.raw_input_prompt {
/* nothing needed here */
pre.raw_input_prompt {
/* nothing needed here. */
}

input.raw_input {
font-family: inherit;
font-family: @font-family-monospace;
font-size: inherit;
color: inherit;
width: auto;
Expand Down

0 comments on commit e8b3c17

Please sign in to comment.