Skip to content
Browse files

added promptText function for setting the text of the current prompt

  • Loading branch information...
1 parent 29f7c2c commit 421b5c12025e6579a3d2d7390751a5ad30ff3d8b Chris Done committed May 29, 2010
Showing with 12 additions and 1 deletion.
  1. +2 −1 demo.html
  2. +10 −0 jquery.console.js
View
3 demo.html
@@ -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;
@@ -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);
View
10 jquery.console.js
@@ -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(){

0 comments on commit 421b5c1

Please sign in to comment.
Something went wrong with that request. Please try again.