1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 05:38:00 +01:00

Changed the behavior when commandline.input was canceled.

When commandline.input is canceled, should not do callback to act like Vim,
This commit is contained in:
anekos
2009-02-18 17:45:56 +09:00
parent d3d8e21fa9
commit 60509096b3

View File

@@ -529,7 +529,7 @@ function CommandLine() //{{{
autocompleteTimer.tell(false);
});
liberator.registerCallback("cancel", modes.PROMPT, closePrompt);
liberator.registerCallback("cancel", modes.PROMPT, cancelPrompt);
liberator.registerCallback("submit", modes.PROMPT, closePrompt);
liberator.registerCallback("change", modes.PROMPT, function (str) {
if (input.complete)
@@ -542,6 +542,14 @@ function CommandLine() //{{{
context.fork("input", 0, commandline, input.complete);
});
function cancelPrompt(value)
{
let callback = input.cancel;
input = {};
if (callback)
callback.call(commandline, value != null ? value : commandline.command);
}
function closePrompt(value)
{
let callback = input.submit;
@@ -1202,6 +1210,7 @@ function CommandLine() //{{{
submit: callback,
change: extra.onChange,
complete: extra.completer,
cancel: extra.onCancel,
};
modes.push(modes.COMMAND_LINE, modes.PROMPT);