##// END OF EJS Templates
Backport PR #10489: Prefer execution when there's only a single line entered...
Backport PR #10489: Prefer execution when there's only a single line entered Closes gh-10425 The heuristic here is to treat a single line specially, and always evaluate it as if the cursor was at the end. An alternative heuristic could be to do this if the cursor is on the last line of the input. This could also cause some weird effects if you e.g. type `for a in range(5):`, move the cursor back a few places and press enter - you'll get a newline inserted in the text, but it will indent as if it were after the colon. I'm still trying to think if there's a better way to approach it.

File last commit:

r22615:3d83950a
r23583:13833706
Show More
autogen_config.py
33 lines | 1.0 KiB | text/x-python | PythonLexer
#!/usr/bin/env python
from os.path import join, dirname, abspath
from IPython.terminal.ipapp import TerminalIPythonApp
from ipykernel.kernelapp import IPKernelApp
here = abspath(dirname(__file__))
options = join(here, 'source', 'config', 'options')
generated = join(options, 'config-generated.txt')
def write_doc(name, title, app, preamble=None):
filename = join(options, name+'.rst')
with open(filename, 'w') as f:
f.write(title + '\n')
f.write(('=' * len(title)) + '\n')
f.write('\n')
if preamble is not None:
f.write(preamble + '\n\n')
f.write(app.document_config_options())
if __name__ == '__main__':
# Touch this file for the make target
with open(generated, 'w'):
pass
write_doc('terminal', 'Terminal IPython options', TerminalIPythonApp())
write_doc('kernel', 'IPython kernel options', IPKernelApp(),
preamble=("These options can be used in :file:`ipython_kernel_config.py`. "
"The kernel also respects any options in `ipython_config.py`"),
)