This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

Visual Studio
VS 2003+

Visual Studio Word Wrap

When working with a Visual Studio code editor and using a low-resolution display, it can be difficult to see the full length of lines of source code. This problem can be alleviated by enabling the code editor's word wrap and visual glyphs settings.

Word Wrap

The default configuration for Visual Studio code editors is to allow the length of a line of code to be much wider than can be displayed on the screen. When the caret reaches the edge of the viewable area, the editing window scrolls to ensure that additional text remains visible. It is good practice to use short lines of code that are entirely visible on a standard sized screen, possible using visual column guides to mark a suitable width. However, sometimes you may need to use a low-resolution display where this is impractical. In such situations, you may prefer to enable word wrapping.

The word wrap facility prevents lines of code from extending beyond the edge of editor windows. When enabled, long lines are split at word boundaries. Text that would have extended too far is moved onto the next line with very long lines of code extending over multiple lines. However, when the file is save, the automatically inserted line breaks are not included, ensuring that the code is correctly formatted when you disable word wrapping.

In Visual Studio 2003, each automatic line break is marked with a visual glyph; a small icon at the end of the line. This facility is available in later versions of Visual Studio but can be enabled and disabled according to your preference.

Enabling Word Wrap

The word wrap setting is found in the Options dialog box, which may be displayed by selecting Options from the Tools menu. Within the list of settings groups expand the Text Editor and C# branches and select General. You can enable or disable word wrap using the "Word wrap" checkbox. In Visual Studio 2005 or later, you can also enable or disable the word wrap visual glyphs.

NB: This setting is available for other languages than C#. Expand the appropriate sub-item beneath Text Editor to find alternative options.

Visual Studio Word Wrap and Visual Glyphs

28 February 2010