Skip to content

Add configurable autoindent option to ZMQTerminalInteractiveShell #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion jupyter_console/ptshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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):
Expand Down