diff --git a/questionary/constants.py b/questionary/constants.py index 9aab0d73..94c5ff4f 100644 --- a/questionary/constants.py +++ b/questionary/constants.py @@ -28,7 +28,7 @@ DEFAULT_QUESTION_PREFIX = "?" # Message shown when a user aborts a question prompt using CTRL-C -DEFAULT_KBI_MESSAGE = "Cancelled by user" +DEFAULT_KBI_MESSAGE = "\nCancelled by user\n" # Default text shown when the input is invalid INVALID_INPUT = "Invalid input" diff --git a/questionary/form.py b/questionary/form.py index be351e9a..17d13071 100644 --- a/questionary/form.py +++ b/questionary/form.py @@ -93,9 +93,7 @@ def ask( try: return self.unsafe_ask(patch_stdout) except KeyboardInterrupt: - print("") print(kbi_msg) - print("") return {} async def ask_async( @@ -115,7 +113,5 @@ async def ask_async( try: return await self.unsafe_ask_async(patch_stdout) except KeyboardInterrupt: - print("") print(kbi_msg) - print("") return {} diff --git a/questionary/prompt.py b/questionary/prompt.py index 5cabcee5..0373f517 100644 --- a/questionary/prompt.py +++ b/questionary/prompt.py @@ -77,9 +77,7 @@ def prompt( try: return unsafe_prompt(questions, answers, patch_stdout, true_color, **kwargs) except KeyboardInterrupt: - print("") print(kbi_msg) - print("") return {} diff --git a/questionary/question.py b/questionary/question.py index 64ae8c5b..978ec8c2 100644 --- a/questionary/question.py +++ b/questionary/question.py @@ -42,7 +42,7 @@ async def ask_async( sys.stdout.flush() return await self.unsafe_ask_async(patch_stdout) except KeyboardInterrupt: - print("\n{}\n".format(kbi_msg)) + print("{}".format(kbi_msg)) return None def ask( @@ -63,7 +63,7 @@ def ask( try: return self.unsafe_ask(patch_stdout) except KeyboardInterrupt: - print("\n{}\n".format(kbi_msg)) + print("{}".format(kbi_msg)) return None def unsafe_ask(self, patch_stdout: bool = False) -> Any: