##// END OF EJS Templates
Merge pull request #11273 from Carreau/re-autoindent...
meeseeksdev[bot] -
r24501:a85a08cc merge
parent child Browse files
Show More
@@ -0,0 +1,2 b''
1 The autoindent feature that was deprecated in 5.x was re-enabled and
2 un-deprecated in :ghpull:`11257`
@@ -250,8 +250,7 b' class InteractiveShell(SingletonConfigurable):'
250 250 objects are automatically called (even if no arguments are present).
251 251 """
252 252 ).tag(config=True)
253 # TODO: remove all autoindent logic and put into frontends.
254 # We can't do this yet because even runlines uses the autoindent.
253
255 254 autoindent = Bool(True, help=
256 255 """
257 256 Autoindent IPython code entered interactively.
@@ -82,8 +82,6 b' class TerminalMagics(Magics):'
82 82 @line_magic
83 83 def autoindent(self, parameter_s = ''):
84 84 """Toggle autoindent on/off (deprecated)"""
85 print("%autoindent is deprecated since IPython 5: you can now paste "
86 "multiple lines without turning autoindentation off.")
87 85 self.shell.set_autoindent()
88 86 print("Automatic indentation is:",['OFF','ON'][self.shell.autoindent])
89 87
@@ -112,13 +112,19 b' def newline_or_execute_outer(shell):'
112 112 if not (d.on_last_line or
113 113 d.cursor_position_row >= d.line_count - d.empty_line_count_at_the_end()
114 114 ):
115 b.insert_text('\n' + (' ' * (indent or 0)))
115 if shell.autoindent:
116 b.insert_text('\n' + (' ' * (indent or 0)))
117 else:
118 b.insert_text('\n')
116 119 return
117 120
118 121 if (status != 'incomplete') and b.accept_handler:
119 122 b.validate_and_handle()
120 123 else:
121 b.insert_text('\n' + (' ' * (indent or 0)))
124 if shell.autoindent:
125 b.insert_text('\n' + (' ' * (indent or 0)))
126 else:
127 b.insert_text('\n')
122 128 return newline_or_execute
123 129
124 130
@@ -67,7 +67,6 b' Example config file'
67 67 'mycode.py',
68 68 'fancy.ipy'
69 69 ]
70 c.InteractiveShell.autoindent = True
71 70 c.InteractiveShell.colors = 'LightBG'
72 71 c.InteractiveShell.confirm_exit = False
73 72 c.InteractiveShell.editor = 'nano'
@@ -146,7 +146,7 b' The built-in magics include:'
146 146 :magic:`macro`, :magic:`recall`, etc.
147 147
148 148 - Functions which affect the shell: :magic:`colors`, :magic:`xmode`,
149 :magic:`autoindent`, :magic:`automagic`, etc.
149 :magic:`automagic`, etc.
150 150
151 151 - Other functions such as :magic:`reset`, :magic:`timeit`,
152 152 :cellmagic:`writefile`, :magic:`load`, or :magic:`paste`.
General Comments 0
You need to be logged in to leave comments. Login now