From 7d115877926d8c9b6a3c2fca5ef1efac008c5c15 Mon Sep 17 00:00:00 2001 From: cnrrobertson Date: Mon, 3 Oct 2022 16:17:00 -0400 Subject: [PATCH] Add configurable autoindent option in ZMQTerminalInteractiveShell --- jupyter_console/ptshell.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/jupyter_console/ptshell.py b/jupyter_console/ptshell.py index 1dae25b..a1fb0f9 100644 --- a/jupyter_console/ptshell.py +++ b/jupyter_console/ptshell.py @@ -203,6 +203,10 @@ class ZMQTerminalInteractiveShell(SingletonConfigurable): "printf \"\\x1b[38;2;255;100;0mTRUECOLOR\\x1b[0m\\n\"") ) + autoindent = Bool(True, config=True, + help="Autoindent code entered interactively." + ) + history_load_length = Integer(1000, config=True, help="How many history items to load into memory" ) @@ -481,7 +485,10 @@ def _(event): if (not more) and b.accept_handler: b.validate_and_handle() else: - b.insert_text('\n' + indent) + if self.autoindent: + b.insert_text('\n' + indent) + else: + b.insert_text('\n') @kb.add("c-c", filter=has_focus(DEFAULT_BUFFER)) def _(event):