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

Commit

Permalink
Merged all changes made in tryhaskell's version of jquery-console.
Browse files Browse the repository at this point in the history
 o Tab is now a control character
 o now ignoring alt+tab
  • Loading branch information
spratt committed Jun 3, 2010
1 parent 6fa359b commit 1b5af6d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion jquery.console.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
// Constants
// Some are enums, data types, others just for optimisation
var keyCodes = { left:37,right:39,up:38,down:40,back:8,del:46,
end:35,start:36,ret:13 };
end:35,start:36,ret:13,tab:18};
var cursor = '<span class="jquery-console-cursor">&nbsp;</span>';
// Opera only works with this character, not <wbr> or &shy;,
// but IE6 displays this character, which is bad, so just use
Expand Down Expand Up @@ -100,6 +100,7 @@
},100);
}
extern.inner = inner;
extern.typer = typer;
extern.scrollToBottom = scrollToBottom;
})();

Expand Down Expand Up @@ -201,6 +202,9 @@
// Handle key press
typer.keypress(function(e){
var keyCode = e.keyCode || e.which;
if (isIgnorableKey(e)) {
return false;
}
if (acceptInput && cancelKeyPress != keyCode && keyCode >= 32){
if (cancelKeyPress) return false;
if (typeof config.charInsertTrigger == 'undefined' ||
Expand All @@ -223,6 +227,11 @@
);
};

function isIgnorableKey(e) {
// for now just filter alt+tab that we receive on some platforms when
// user switches windows (goes away from the browser)
return ((e.keyCode == keyCodes.tab || e.keyCode == 192) && e.altKey);
};
////////////////////////////////////////////////////////////////////////
// Handle console control keys
// E.g. up, down, left, right, backspc, return, etc.
Expand Down

0 comments on commit 1b5af6d

Please sign in to comment.