diff --git a/modules/shared_options.py b/modules/shared_options.py index 53fbd9dd..7346d1d8 100644 --- a/modules/shared_options.py +++ b/modules/shared_options.py @@ -390,6 +390,7 @@ options_templates.update( "show_rescale_cfg": OptionInfo(False, "Display the Rescale CFG Slider").info("feature for v-pred checkpoints").needs_reload_ui(), "show_mahiro": OptionInfo(False, "Display the MaHiRo Toggle").info('see blue-arxiv - id: 2024-1208.1').needs_reload_ui(), "paste_safe_guard": OptionInfo(False, 'Disable the "Read generation parameters" button (↙️) when negative prompt is not empty'), + "ctrl_enter_interrupt": OptionInfo(False, "Revert [Ctrl + Enter] to only interrupt the generation").info('the current "intended" behavior is to interrupt the current generation then immediately start a new one'), "div_classic": OptionDiv(), "compact_prompt_box": OptionInfo(False, "Compact Prompt Layout").info("put prompts inside the Generate tab, leaving more space for the gallery").needs_reload_ui(), "dimensions_and_batch_together": OptionInfo(True, "Show Width/Height and Batch sliders in same row").needs_reload_ui(), diff --git a/script.js b/script.js index 361a2e89..986af765 100644 --- a/script.js +++ b/script.js @@ -159,8 +159,10 @@ document.addEventListener("keydown", function (e) { get_uiCurrentTabContent().querySelector("button[id$=_skip]"); if (isCtrlKey && isEnter) { + e.preventDefault(); if (interruptButton.style.display === "block") { interruptButton.click(); + if (opts.ctrl_enter_interrupt) return; const callback = (mutationList) => { for (const mutation of mutationList) { if ( @@ -179,7 +181,6 @@ document.addEventListener("keydown", function (e) { } else { generateButton.click(); } - e.preventDefault(); } if (isAltKey && isEnter) {