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

add the shortcut "ctrl+l" to clear the entire screen, and expose the "clearScreen" function. #48

Merged
merged 1 commit into from
Sep 14, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion jquery.console.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@
70: moveForward,
// C-k
75: deleteUntilEnd,
// C-l
76: clearScreen,
// C-u
85 : clearCurrentPrompt
85: clearCurrentPrompt
};
if(config.ctrlCodes) {
$.extend(ctrlCodes, config.ctrlCodes);
Expand Down Expand Up @@ -164,6 +166,7 @@
extern.scrollToBottom = scrollToBottom;
extern.report = report;
extern.showCompletion = showCompletion;
extern.clearScreen = clearScreen;
})();

////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -427,6 +430,13 @@
function clearCurrentPrompt() {
extern.promptText("");
};

function clearScreen() {
inner.children(".jquery-console-prompt-box, .jquery-console-message").remove();
extern.report(" ");
extern.promptText("");
extern.focus();
};

function deleteNextWord() {
// A word is defined within this context as a series of alphanumeric
Expand Down