Skip to content

Commit

Permalink
Activated "uparrow" history browsing! simple!
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgao committed Oct 21, 2010
1 parent 6abdb49 commit a23e40e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions IPython/frontend/html/js/notebook.js
Expand Up @@ -165,6 +165,7 @@ Manager.prototype.order = function (idx) {
}

function Message(msg_id, obj) {
this.msg_id = msg_id
this.num = msg_id == -1?exec_count+1:exec_count
this.obj = $(document.createElement("div"))
this.obj.addClass("message")
Expand Down Expand Up @@ -199,9 +200,13 @@ Message.prototype.activate = function () {
this.text.focus()

var thisObj = this
this.text.keypress(function(e) {
this.text.keydown(function(e) {
if (e.which == 13)
thisObj.submit(e.target.value)
else if (e.which == 38) {
manager.order(-1).activate()
manager.ondeck.remove()
}
})
}
Message.prototype.submit = function (code) {
Expand All @@ -210,7 +215,11 @@ Message.prototype.submit = function (code) {
comet.stop()
execute(code, function(json) {
thisObj.active = false
manager.set(json.parent_header.msg_id)
if (manager.ondeck != null)
manager.set(json.parent_header.msg_id)
else
//TODO: Fix ordering!
manager.messages[json.parent_header.msg_id] = thisObj
comet.start()
})
}
Expand All @@ -226,5 +235,5 @@ Message.prototype.setOutput = function(value, header) {
var o = "Out [<span class='cbold'>"+this.num+"</span>]:"
this.out_head.html(o)
}
this.output.append(value)
this.output.html(value)
}

0 comments on commit a23e40e

Please sign in to comment.