<type>documentation</type>
<domain>edit</domain>
<id>auto-indent</id>
<title>Auto-Indent</title>
<date>$Date$</date>
<version>$Revision$</version>
<product>all</product>

Wing auto-indents code as you create new lines with ``Return``, by adding leading white
space appropriate for the context. Enough white space is inserted to match the indentation
level of the previous line, possibly adding or removing a level of indentation if
a block has been started (with ``if``, ``for``, and others) or ended (with ``return``).

~~~if WINGPRO:
Some of the `auto-editing <ref:edit/auto-editing>`__ operations also result in 
auto-indentation.

**Disabling Auto-Indent**

Auto-indent can be disabled with the `Editor > Indentation > Auto-indent
<script:show_preferences_gui#prefname="edit.auto-indent">`__ preference. When disabled,
the `Tab <ref:edit/the-tab-key>`__ key may be used to insert indentation, depending on
its configuration.

**Auto-Indent After Paste**

Wing also auto-indents code when pasting multiple lines of Python. If the auto-indent is
incorrect, a single ``Undo`` will return the pasted text to its original indentation
level, or the text can be selected and adjusted with the indentation toolbar, or the
``Source > Indentation`` menu items. Auto-indent during ``Paste``
can be disabled with the `Edit > Clipboard > Adjust Indent After Paste
<script:show_preferences_gui#prefname="edit.adjust-indent-after-paste">`__ preference.

Wing also converts indentation style during ``Paste`` to match the target
file.  This can be disabled with the `Edit > Clipboard > Convert Indent Style
On Paste <script:show_preferences_gui#prefname="edit.convert-indents-on-paste">`__
preference.
~~~

