mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 11:17:58 +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:
@@ -529,7 +529,7 @@ function CommandLine() //{{{
|
|||||||
autocompleteTimer.tell(false);
|
autocompleteTimer.tell(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.registerCallback("cancel", modes.PROMPT, closePrompt);
|
liberator.registerCallback("cancel", modes.PROMPT, cancelPrompt);
|
||||||
liberator.registerCallback("submit", modes.PROMPT, closePrompt);
|
liberator.registerCallback("submit", modes.PROMPT, closePrompt);
|
||||||
liberator.registerCallback("change", modes.PROMPT, function (str) {
|
liberator.registerCallback("change", modes.PROMPT, function (str) {
|
||||||
if (input.complete)
|
if (input.complete)
|
||||||
@@ -542,6 +542,14 @@ function CommandLine() //{{{
|
|||||||
context.fork("input", 0, commandline, input.complete);
|
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)
|
function closePrompt(value)
|
||||||
{
|
{
|
||||||
let callback = input.submit;
|
let callback = input.submit;
|
||||||
@@ -1202,6 +1210,7 @@ function CommandLine() //{{{
|
|||||||
submit: callback,
|
submit: callback,
|
||||||
change: extra.onChange,
|
change: extra.onChange,
|
||||||
complete: extra.completer,
|
complete: extra.completer,
|
||||||
|
cancel: extra.onCancel,
|
||||||
};
|
};
|
||||||
|
|
||||||
modes.push(modes.COMMAND_LINE, modes.PROMPT);
|
modes.push(modes.COMMAND_LINE, modes.PROMPT);
|
||||||
|
|||||||
Reference in New Issue
Block a user