Slick V3.3 manual VSARG2REQUIRESEDITORCTL VSARG2MARK VSARG2REQUIRESABSELECTION

Models: V3.3

1 568
Download 568 pages 2.03 Kb
Page 191
Image 191

Surround With

surround_with - This command is used to display the Surround With dialog, allowing you to pick a structure to surround selected text with. This command can be bound to a key—see Creating Bindings for more information.

sur_text - This is a Slick-C®function that can only be used inside of a Surround With template. It is used to indicate where the selected text should be placed and can be used multiple times within a single Surround With template. sur_text can take several parameters, which can appear in any order. The available parameters are:

-beautify- This is the default for C, Java, and others. It beautifies the results of the template expan- sion.

-begin<text> - Prefixes each line of the selection with text.

-deselect- This is the default parameter. It specifies to leave the text deselected.

-end<text> - Suffixes each line of the selection with text.

-ignore<chars> - The -begin, -indent, and -stripbeginoptions will ignore any chars when finding the beginning of the selected line.

-indent- Indents each line of the selection.

-nobeautify- This is the default for HTML, XML, and others. It specifies that the editor should not at- tempt to beautify the results of the template expansion.

-notext- Specifies that no text should be pasted.

-select- Leaves the text selected.

-stripbegin<text> - If any line begins with text, text is removed from the line. This option is ap- plied before -begin.

-stripend<text> - If any line ends with text, text is removed from the line. This option is applied before -end.

surround_with_if - This is a wrapper command that expands the if template for the selected text. This command can be bound to a key—see Creating Bindings for more information.

The use of Surround With can be streamlined by using wrapper commands and key bindings. You can create your own wrapper commands. The following example is the definition of surround_with_if _command void surround_with_if() name_info(',':

VSARG2_REQUIRES_EDITORCTL VSARG2_MARK VSARG2_REQUIRES_AB_SELECTION)

{

surround_with('if');

}

You must change the name of the command and the argument passed to surround_with. The argument does not have to be an exact match with the template name. For instance, calling surround_with('i') will prompt you to select the if, if...else, or include once template. If there is an exact match, that template

169

Page 191
Image 191
Slick V3.3 manual VSARG2REQUIRESEDITORCTL VSARG2MARK VSARG2REQUIRESABSELECTION