Skip to content

Commit

Permalink
Another hack for console, to fix double-prompting.
Browse files Browse the repository at this point in the history
We really should use a different library / write our own terminal
library from scratch. The ugly hacks are piling up.
  • Loading branch information
int3 committed Apr 21, 2012
1 parent fc8ccfc commit 835e191
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion browser/frontend.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ $(document).ready ->

user_input = (n_bytes, resume) ->
oldPrompt = controller.promptLabel
controller.promptLabel = '> '
controller.promptLabel = ''
controller.reprompt()
oldHandle = controller.commandHandle
controller.commandHandle = (line) ->
Expand Down
13 changes: 11 additions & 2 deletions third_party/jquery.console.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,17 @@
enableInput();
promptBox = $('<div class="jquery-console-prompt-box"></div>');
var label = $('<span class="jquery-console-prompt-label"></span>');
var labelText = extern.continuedPrompt? extern.continuedPromptLabel :
extern.promptLabel;
var labelText = extern.continuedPrompt ? extern.continuedPromptLabel :
extern.promptLabel;
if (lastMsg) {
var text = lastMsg.text();
if (_.last(text) !== '\n') {
var lines = text.split('\n');
labelText = _.last(lines) + labelText;
lines.length--;
lastMsg.text(lines.join('\n'));
}
}
promptBox.append(label.text(labelText).show());
label.html(label.html().replace(' ','&nbsp;'));
prompt = $('<span class="jquery-console-prompt"></span>');
Expand Down

0 comments on commit 835e191

Please sign in to comment.