diff --git a/HELP.md b/HELP.md index 66cf41d7..81287746 100644 --- a/HELP.md +++ b/HELP.md @@ -155,6 +155,7 @@ Console | `~` | open | `Ctrl + p` | paste path of current directory | `Ctrl + z` | cancel current prompt +| `Ctrl + l` | clear | `Esc` | close Config diff --git a/lib/client/console.js b/lib/client/console.js index 6512702b..0b5a7fee 100644 --- a/lib/client/console.js +++ b/lib/client/console.js @@ -45,6 +45,7 @@ var CloudCmd, Util, DOM, CloudFunc, $; } this.show = show; + this.clear = clear; // Handle a command. function handler(command) { @@ -66,16 +67,7 @@ var CloudCmd, Util, DOM, CloudFunc, $; jqconsole = $(Element).jqconsole('', '> '); - jqconsole.RegisterShortcut('Z', function() { - jqconsole.SetPromptText(''); - }); - - jqconsole.RegisterShortcut('P', function() { - var command = jqconsole.GetPromptText(); - - command += DOM.getCurrentDirPath(); - jqconsole.SetPromptText(command); - }); + addShortCuts(jqconsole); } CloudCmd.View.show(Element, { @@ -131,6 +123,27 @@ var CloudCmd, Util, DOM, CloudFunc, $; } } + function addShortCuts(jqconsole) { + jqconsole.RegisterShortcut('Z', function() { + jqconsole.SetPromptText(''); + }); + + jqconsole.RegisterShortcut('L', clear); + + jqconsole.RegisterShortcut('P', function() { + var command = jqconsole.GetPromptText(); + + command += DOM.getCurrentDirPath(); + jqconsole.SetPromptText(command); + }); + } + + function clear() { + jqconsole.Reset(); + addShortCuts(jqconsole); + jqconsole.Prompt(true, handler); + } + function load(callback) { var dir = CloudCmd.LIBDIRCLIENT + 'console/', jsPath = dir + 'lib/',