Share via


TextSelection.Unindent Method

Removes indents from the text selection by the number of indentation levels given.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
Sub Unindent ( _
    Count As Integer _
)
void Unindent(
    int Count
)
void Unindent(
    [InAttribute] int Count
)
abstract Unindent : 
        Count:int -> unit
function Unindent(
    Count : int
)

Parameters

  • Count
    Type: System.Int32

    Optional. The number of display indent levels to remove from each line in the text selection. The default is 1.

Remarks

Unindent removes indents in the text selection by the number of display columns indicated by the global setting for one indentation level. Unindent does not do smart formatting or remove indents for lines based on the context of the code. Tabs and characters are deleted and inserted as necessary to remove one indentation level, according to the current global settings for tab and indent level size.

Unindent behaves differently depending on whether the text selection is continuous or columnar. If it is continuous, indents are removed from all lines partially or completely within the selection at the first column. If it is a columnar selection, indents are removed from the text selection at the left edge of the selection.

If the value of Count is negative, then Unindent performs like the Indent method.

Unindent fails if the value of Count is greater than or equal to 10,000.

Examples

Sub UnIndentExample()
   ' Before running this example, open a text document.
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection
   ' Go to first line in document and indent it.
   objSel.GotoLine(1, False)
   objSel.Indent(2)
   MsgBox("Indented two places, now unindenting one place...")
   objSel.Unindent(1)
End Sub

.NET Framework Security

See Also

Reference

TextSelection Interface

EnvDTE Namespace