##// END OF EJS Templates
Undeprecate autoindent...
Matthias Bussonnier -
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 objects are automatically called (even if no arguments are present).
250 objects are automatically called (even if no arguments are present).
251 """
251 """
252 ).tag(config=True)
252 ).tag(config=True)
253 # TODO: remove all autoindent logic and put into frontends.
253
254 # We can't do this yet because even runlines uses the autoindent.
255 autoindent = Bool(True, help=
254 autoindent = Bool(True, help=
256 """
255 """
257 Autoindent IPython code entered interactively.
256 Autoindent IPython code entered interactively.
@@ -82,8 +82,6 b' class TerminalMagics(Magics):'
82 @line_magic
82 @line_magic
83 def autoindent(self, parameter_s = ''):
83 def autoindent(self, parameter_s = ''):
84 """Toggle autoindent on/off (deprecated)"""
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 self.shell.set_autoindent()
85 self.shell.set_autoindent()
88 print("Automatic indentation is:",['OFF','ON'][self.shell.autoindent])
86 print("Automatic indentation is:",['OFF','ON'][self.shell.autoindent])
89
87
@@ -112,13 +112,19 b' def newline_or_execute_outer(shell):'
112 if not (d.on_last_line or
112 if not (d.on_last_line or
113 d.cursor_position_row >= d.line_count - d.empty_line_count_at_the_end()
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 return
119 return
117
120
118 if (status != 'incomplete') and b.accept_handler:
121 if (status != 'incomplete') and b.accept_handler:
119 b.validate_and_handle()
122 b.validate_and_handle()
120 else:
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 return newline_or_execute
128 return newline_or_execute
123
129
124
130
@@ -67,7 +67,6 b' Example config file'
67 'mycode.py',
67 'mycode.py',
68 'fancy.ipy'
68 'fancy.ipy'
69 ]
69 ]
70 c.InteractiveShell.autoindent = True
71 c.InteractiveShell.colors = 'LightBG'
70 c.InteractiveShell.colors = 'LightBG'
72 c.InteractiveShell.confirm_exit = False
71 c.InteractiveShell.confirm_exit = False
73 c.InteractiveShell.editor = 'nano'
72 c.InteractiveShell.editor = 'nano'
@@ -146,7 +146,7 b' The built-in magics include:'
146 :magic:`macro`, :magic:`recall`, etc.
146 :magic:`macro`, :magic:`recall`, etc.
147
147
148 - Functions which affect the shell: :magic:`colors`, :magic:`xmode`,
148 - Functions which affect the shell: :magic:`colors`, :magic:`xmode`,
149 :magic:`autoindent`, :magic:`automagic`, etc.
149 :magic:`automagic`, etc.
150
150
151 - Other functions such as :magic:`reset`, :magic:`timeit`,
151 - Other functions such as :magic:`reset`, :magic:`timeit`,
152 :cellmagic:`writefile`, :magic:`load`, or :magic:`paste`.
152 :cellmagic:`writefile`, :magic:`load`, or :magic:`paste`.
General Comments 0
You need to be logged in to leave comments. Login now