<type>documentation</type>
<domain>edit</domain>
<id>how-indent-style-is-determined</id>
<title>How Indent Style is Determined</title>
<date>$Date: 2006-06-13 15:25:41 -0400 (Tue, 13 Jun 2006) $</date>
<version>$Revision: 13256 $</version>
<product>all</product>

Wing can work with files with different indentation styles, including tab-only,
space-only, and tab+space indentation.

When an existing file is opened, it is scanned to determine what type of indentation is
used in that file. Wing then matches new indentation added during editing
to the form already found in the file. If mixed forms of indentation are found, the most
common form is used.
~~~if WING101:
If no indentation is found, space-only indents are inserted matching the
`Editor > Indentation > Default Indent Size <script:show_preferences_gui#prefname="edit.indent-size">`__ 
preference. 
~~~
~~~if not WING101:
If no indentation is found, Wing uses the `Preferred Indent Style 
<script:view_project_properties#highlighted_attrib="proj.preferred-indent-style">`__ 
set in ``Project Properties``, or the `Editor > Indentation > Default Indent Style 
<script:show_preferences_gui#prefname="edit.indent-style">`__ and `Editor > Indentation > Default Indent Size 
<script:show_preferences_gui#prefname="edit.indent-size">`__ preferences.

**Changing Indent Style**

To change the indentation style in an existing file, use `Indentation
<ref:editor/indentation-manager>`__ in the ``Tools`` menu.

You can use a different indentation style for non-Python files without first converting
existing indent styles by changing the 
``Indent Style`` property in ``File Properties``, which is accessed by
right-clicking on the editor.   Wing will warn that you are entering inconsistent styles of
indentation, but the warning can be disabled from the warning dialog or from the `Editor >
Indentation > Show Override Warning Dialog
<script:show_preferences_gui#prefname="edit.show-non-py-indent-warning">`__ preference.

For Python files, where indentation has syntactic significance, the ``Indent Style``
cannot be altered without converting the whole file using the `Indentation
<ref:edit/indentation-manager>`__ tool, which is accessed from the button next to the
``Indent Style`` property in ``File Properties`` or from the ``Tools`` menu.

**Tab Size**

The size of the tab character is controlled with the `Editor > Indentation > Default Tab Size 
<script:show_preferences_gui#prefname="edit.tab-size">`__ preference. This
defines the position of tab stops, counting in multiples of tab size from the start 
of the line.

This preference is ignored in Python files with mixed tab and space indents, where the
file is always shown in the way that the Python interpreter would see it. 

**Disabling Indent Analysis**

Although not recommented, it is possible to disable any attempt to use file contents
to determine the style of indentation to use while editing.  This is done with 
the `Editor > Indentation > Use Indent Analysis
<script:show_preferences_gui#prefname="edit.use-indent-analysis">`__ preference. 
When this is disabled, Wing always uses the `Preferred Indent Style
<script:view_project_properties#highlighted_attrib="proj.preferred-indent-style">`__ set
in ``Project Properties``, or the `Editor > Indentation > Default Indent Style
<script:show_preferences_gui#prefname="edit.indent-style">`__ and `Editor > Indentation >
Default Indent Size <script:show_preferences_gui#prefname="edit.indent-size">`__
preferences. 
~~~


