Skip to content
This repository has been archived by the owner on Nov 28, 2018. It is now read-only.

Commit

Permalink
added promptText function for setting the text of the current prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Done committed May 29, 2010
1 parent 29f7c2c commit 421b5c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion demo.html
Expand Up @@ -36,7 +36,7 @@
/* Second console */
var console2 = $('<div class="console2">');
$('body').append(console2);
console2.console({
var controller2 = console2.console({
promptLabel: 'JavaScript> ',
commandValidate:function(line){
if (line == "") return false;
Expand All @@ -52,6 +52,7 @@
promptHistory:true,
welcomeMessage:'Enter some JavaScript expressions to evaluate.'
});
controller2.promptText('5 * 4');
/* Second console */
var console3 = $('<div class="console2">');
$('body').append(console3);
Expand Down
10 changes: 10 additions & 0 deletions jquery.console.js
Expand Up @@ -420,6 +420,16 @@
} else return false;
};

extern.promptText = function(text){
if (text) {
promptText = text;
if (column > promptText.length)
column = promptText.length;
updatePromptDisplay();
}
return promptText;
};

////////////////////////////////////////////////////////////////////////
// Update the prompt display
function updatePromptDisplay(){
Expand Down

0 comments on commit 421b5c1

Please sign in to comment.