IEditorOperations.DeleteHorizontalWhiteSpace Method ()


Deletes all white space from the beginnings and ends of the selected lines, and trims internal white space.

Namespace:   Microsoft.VisualStudio.Text.Operations
Assembly:  Microsoft.VisualStudio.Text.UI (in Microsoft.VisualStudio.Text.UI.dll)

bool DeleteHorizontalWhiteSpace()

Return Value

Type: System.Boolean

true if the edit succeeded, otherwise false.

If there is no selection, the white space around the caret is trimmed so that only one space or tab remains. If there is only one space or tab, then this operation does nothing.

If there is a selection, then the white space at the beginning or end of a line contained within the selection is completely deleted. If there is at least one block of contiguous white space longer than one character in the selection, then all white space between the first and last non-white space characters is trimmed so that only one space or tab remains for each contiguous block. If there are only contiguous runs of a single space or tab contained within the selection, then all spaces and tabs in the selection are deleted.

Return to top