From 60509096b373254e6c976c4c60b5c541e0994b2c Mon Sep 17 00:00:00 2001 From: anekos Date: Wed, 18 Feb 2009 17:45:56 +0900 Subject: [PATCH] Changed the behavior when commandline.input was canceled. When commandline.input is canceled, should not do callback to act like Vim, --- common/content/ui.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/content/ui.js b/common/content/ui.js index f9b90b4f..6fdf8239 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -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);