The IDE ships with auto-indent turned on. This causes leading white space to be added to each newly created line, as return or enter are pressed. Enough white space is inserted to match the indentation level of the previous line, possibly adding or removing a level of indentation if this is indicated by context in the source (such as if, while, or return).
Note that if preference Auto-indent is turned off, auto-indent does not occur until the tab key is pressed.
In Python code, Wing also auto-indents after typing a colon after else, elif, except, and finally. Indentation will go to the closest matching if or try statement. I f there are multiple possible matching statements, the colon key can be pressed repeatedly to toggle through the possible positions for the line. Similarly, when Smart Tab is selected as the Tab Key Action, then pressing the Tab key repeatedly will toggle the line through the possible indent positions. This can also be accomplished with the Indent to Match toolbar and menu items (regardless of selected tab key action).
When pasting multiple lines into Python code and the caret is in the indent region or on a blank line, Wing will auto-indent pasted text as follows: (1) If the caret is in column zero, the text is indented to match the context, (2) If the caret is within the indent region but not in column zero, the text is indented to that position. 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 menu items or key equivalents.
|« 4.11.2. Indentation Policy||Table of Contents||4.11.4. The Tab Key »|