Text Editing Features

This section describes some of the more common text editing tools and features in Stylus Studio.

Simple Text Editing

Select the text you want to edit and then do any of the following:

You can select a portion of text and move it to a new location by dragging it. You can drag text from one document to another. You can drag text from documents outside Stylus Studio to a document in Stylus Studio.

Code Folding

Code folding is the ability to collapse three or more lines of code in XML-based editors. For example, this code segment:

<author> 
            <first-name>Joe</first-name> 
            <last-name>Bob</last-name> 
            <award>Trenton Literary Review Honorable Mention</award> 
</author> 

when collapsed, appears as this:

<author> 

Code folding allows you to simplify the visual presentation of XML-based code; folding does not affect the underlying code.

In editors in which code folding is supported, Stylus Studio displays a tree control in the gutter to the left of editing canvas; this is the same area of the editor used to display line numbers, debugging symbols, and back mapping symbols. By default, all code is displayed.

What You Can Fold

In XML-based editors, you can fold

In the XQuery Source editor, you can fold

How to Fold Code
To fold a segment of code, click the [+] symbol associated with that code.

When you fold code, Stylus Studio displays a boxed ellipsis symbol at the end of the line of code you have folded, as shown here:

If you place the pointer in the ellipsis symbol, Stylus Studio displays a tool tip that shows you the collapsed code. The amount of code that appears in the tool tip depends on the area on your desktop you have given the Stylus Studio application.

Sense:X Speeds Editing

As you type, Sense:X prompts you with the possible tags that you can insert at a given location based on the XML Schema associated with the document you are editing. As soon as you type a tag's open bracket, Stylus Studio displays a scrollable list of the elements that are allowed at that location of the document. As shown in Figure 103, there are two entries for book, for example:

If you choose the first book item ( ), Stylus Studio completes the <book tag for you. If you choose the second book item ( ), Stylus Studio completes the entire XML fragment for you, including all attributes and default values described in the associated XML Schema, as shown in Figure 104:

Use the arrow key to move the selection, and press Enter to insert the value you want.

Indent

Indent XML tags to show the hierarchy relationships. Click Indent XML Tags . Stylus Studio indents all text in the active XML document window.

Line Wrap

Stylus Studio automatically wraps lines whose length exceeds 16k characters. You can turn off this feature by selecting Disable from the Line wrap field on the Editor General page of the Options dialog box (Tools > Options).

You can override line wrap settings by selecting Edit > Wrap Lines from the Stylus Studio menu or by clicking the wrap lines button on the tool bar( ).

When line wrapping is on, Stylus Studio wraps lines to fit in the available window; the place at which the line wraps moves as the width of the window changes. Green arrows, as shown in Figure 105, indentify lines that have wrapped.

Spell Checking

By default, Stylus Studio spell checks text as you type using an internal spell checker. Words the spell checker believes are misspelled (or repeated) are underlined with a squiggly line, as shown in Figure 106.

For more information, see Using the Spell Checker.

Font

You can change the font of the text display in Stylus Studio. This change affects only the Stylus Studio display. Beyond personal preference, you might choose to change the font for localization purposes - the available fonts are the fonts that can display the characters in your XML file. For example, in a Japanese file, only two or three font names appear. Click Font Change to display a list of fonts.

Comments

Select the text that you want to be a comment. In the Stylus Studio tool bar, click Comment/Uncomment Selection . To remove comment tags, select the commented text, and click Comment/Uncomment Selection.

Bookmarks

You can set bookmarks in the XML display. Bookmarks allow you to jump to important lines in your file. See Using Bookmarks.

Search/Replace

Search for and replace text you specify. Click Find or Replace in the tool bar. You can also enable Find by pressing Ctrl + F.

When you enable Find, Stylus Studio displays the word in which the cursor is located - whether the cursor is within the word or immediately adjacent to it - in the Findwhat field of the Find dialog box. Similarly, any text you have selected - whole, partial, or multiple words - is displayed in the Find what field.

Note that in addition to specifying case, you can also indicate whether or not you want to use regular expressions in the Find what field and Replace with field. This allows you, for example, to search for a line and replace it with multiple lines, as shown in the following example.

See Sample Regular Expressions for examples of regular expressions and to learn about other sources of information.

 
Free Stylus Studio XML Training:
W3C Member