Editing Files

When editing text or code, the editor provides the customary functionality of a text editor. For code editing the editor provides syntax highlighting and other features.

Selecting Text and Code

To select text, left-click and drag the mouse over the text or use SHIFT+Arrows keys. When selecting text with the ALT key pressed, a rectangular text block will be selected. To select a large piece of text you can place the insertion point to the beginning of the text fragment, then scroll down to the end of the fragment holding the SHIFT key, click the end of the fragment, and release the SHIFT key.

Manipulating Text and Code

The editor allows you to manipulate text in the same ways as most word processing applications or text editors do. For example, you can:

  • copy and paste text or code inside the editor and between several editors or between the editor and other text editing applications;
  • put the code editor into the Overstrike mode using the INSERT key;
  • use the DELETE and BACKSPACE keys to remove text or code.

There are several ways of moving throughout text:

  • mouse and navigation keys;
  • setting bookmarks;
  • using incremental search;
  • Go to Line command.

Note

To use the Go to Line command, in the Edit menu select Go To and choose the required line.

Changing Text Case

Code editor allows changing the case of the input text characters. To switch text to the upper case, select the text block you want to convert and, in the Edit -> Advanced menu, choose Make Uppercase. To make the text lowercase select the required text block and, in the Edit -> Advanced menu, choose Make Lowercase. If you perform these actions with no text selected, case of the current character will be changed.

Text Indenting

Code editor provides text indenting functionality. You can set the indent at some line, so, when you press Enter, this indent is set at the next line. To change line indenting use the Increase Line Indent and Decrease Line Indent options.

To increase or decrease indenting perform the following actions.

  1. Select the text you want to indent.

  2. To increase indenting, in the Edit -> Advanced menu select Increase Line Indent or click the corresponding button on the Text toolbar.

    -or-

    To decrease indenting, in the Edit -> Advanced menu select Decrease Line Indent or click the corresponding button on the Text toolbar.

Setting Bookmarks

Bookmarks make navigating through code easier.

To set a bookmark, navigate to the required line and in the Edit menu select Bookmarks -> Toggle Bookmark or click the corresponding button on the Text toolbar. To remove a bookmark perform the same actions.

To navigate trough bookmarks, go to the Edit -> Bookmarks menu and use the Previous Bookmark and Next Bookmark options, or the corresponding Text toolbar buttons.

To clear all bookmarks, go to the Edit -> Bookmarks menu and select Clear Bookmarks, or click the corresponding Text toolbar button.

Commenting Code

Code Compare allows you to comment out single lines or entire blocks of code in a single click.

To comment out a block of code, select it in the document area and in the Edit menu choose Advanced -> Comment Selection, or click the corresponding button on the Text toolbar. This will insert comment delimiters in the beginning of every line within the selected block.

To uncomment a block of code, select it in the document area and in the Edit menu choose Advanced -> Uncomment Selection, or click the corresponding button on the Text toolbar.

Searching and Replacing Text

You can search and replace text in one or multiple files.

Searching and Replacing Text in the Current Document

You can find and replace text using the Find and Replace window. To open this window press Ctrl+F or Ctrl+H. These techniques allow you to control the scope of find and replace and choose the method of reviewing search matches and replacements.

You should consider the following information when you search and replace text:

  • Options set in the Find and Replace window are global; certain options selected in one dialog box are selected for all the dialogs. These options are Match case, Match whole word, Search all open documents, Search hidden text, Search up, Wildcards, and Regular Expressions.
  • Undo is available only for documents left open after a replace operation.
  • Undo for a Replace All operation rolls back all replacement changes in the current document.

You can search one or more open files or windows and move through the search matches one by one. This allows you to review each individual search match in the context of the text around the match.

To search current document, current project, or all open documents:

  1. Open the items you wish to search.
  2. Press Ctrl+F and switch to the Find mode, if necessary.
  3. In the Look in box, select Current Document, All Open Documents or Entire Solution.
  4. In the Find what text box, enter the text you intend to search for.
  5. Select additional search options to increase the accuracy of the search.
  6. Click Find Next to start the search and continue choosing Find Next until the last file is searched.

When the search passes the beginning or end of the document, a message is displayed in the status bar. A message box appears when the search reaches the starting point.

To replace in the current document or in all open documents:

  1. Open the files you wish to search in.
  2. Press CTRL+H and switch to the Replace mode, if necessary.
  3. In the Look in box, select Current Document or All Open Documents.
  4. In the Find what text box, enter the text you intend to search for.
  5. In the Replace with text box, enter the text with which you intend to replace the search text.
  6. Click Replace and continue clicking Replace until the last match in the last file is replaced. Use Find Next to skip a match you do not want to replace.

You may click Replace All to replace all matches. A message box appears, listing the total number of replacements. The Replace All command replaces all search matches, including those you have skipped with the Find Next button. To reverse Replace All, in the Edit menu choose Undo in each changed file before closing any of the files.

Searching and Replacing Text in Files

You can use the Find/Replace in Files window to perform search and replace operations. To open this window press CTRL+F or CTRL+H, then switch to the Find in Files or Replace in Files mode.

Searching and replacing text in files has the following peculiarities:

  • You can specify a disc folder as search location or even create and use named folder sets.
  • You can only find all occurrences, you cannot use Find Next.

To create a named folder set:

  1. In the Find/Replace in Files window, click the Choose Search Folders button next to the Look In box.
  2. Enter the folder set name in the Folder set combo-box.
  3. Edit the folder list with the arrow buttons.
  4. Click the Apply button. Now you can use this folder set in the Look In box.

To delete a named folder set, click the Choose Search Folders button next to the Look In box, select the folder set in the Folder set combo-box, and click the Delete button.

To search in files:

  1. Press Ctrl+F and switch to the Find in Files mode, if necessary.
  2. In the Look in box, select the required location or enter a folder path or name of a named folder set.
  3. In the Find what text box, enter the text you intend to search for.
  4. Select additional search options to increase the accuracy of the search.
  5. You may specify the file mask for searching in the Look at these file types box.
  6. If necessary, customize the Result options.
  7. Click the Find All button.

After search is finished, all results are displayed in the Find Results window. You may double-click on matches to navigate to them.

To replace in files:

  1. Press CTRL+H and switch to the Replace in Files mode, if necessary.
  2. In the Look in box, select the required location or enter a folder path or name of the named folder set.
  3. In the Find what text box, enter the text you intend to search for.
  4. Select additional search options to increase the accuracy of the search.
  5. If necessary, customize the Result options. Select the Keep modified files open after Replace All check box if you want to be able to undo changes.
  6. You may specify the file mask for replacing in the Look at these file types box.
  7. In the Replace with text box, enter the text with which you intend to replace the search text.
  8. Click Replace and continue clicking Replace until the last match in the last file is replaced. Use Find Next to skip a match you do not want to replace.

You may click Replace All to replace all matches. A message box appears, listing the total number of replacements. The Replace All command replaces all search matches, including those you have skipped with the Find Next button. To reverse Replace All, in the Edit menu choose Undo in each changed file before closing any of the files.

Text editor allows you to search document text view incrementally by entering a search string character by character, then observing the matches found as the search string lengthens. To activate an incremental search, in the Edit menu choose Advanced and then select Incremental Search or press CTRL+I (starts incremental search from the cursor) or CTRL+R, CTRL+B (starts incremental search from the beginning of the document). Then enter the search string to find a matching string. The cursor icon changes to binoculars with an arrow indicating the search direction, and the status bar displays the text ‘Incremental Search:’ and the search string. You can use the BACKSPACE key to remove the last character from the search string. The F3 shortcut moves to the next match, SHIFT+F3 moves to the previous match.

To stop incremental search press the ESC key or click anywhere in the document.

Regular Expressions for Find and Replace

The Find and Replace window contains a list of symbols and signs which you can use to quickly find and replace the required patterns of text. They are called regular expressions.

To select a regular expression, do the following:

  1. In the Find and Replace window, select the Use check box and choose Regular Expressions from the drop-down list. The Expression Builder button next to the Find what field becomes active.
  2. Click the Expression Builder button and select a regular expression from the drop-down list. It is inserted into the Find what field.

The drop-down list contains the following regular expressions:

Syntax Expression Description
. Any single character Matches any single character except the line break.
* Zero or more Matches zero or more occurrences of the preceding expression, finding all possible matches.
+ One or more Matches at least one occurrence of the preceding expression.
^ Beginning of line Anchors the match string to the beginning of a line.
$ End of line Anchors the match string to the beginning of a line.
< Beginning of word Matches only when a word begins at this point in the text.
> End of word Matches only when a word ends at this point in the text.
\n Line break Matches a platform-independent line break. In a Replace expression, inserts a line break.
[] Any single character in the set Matches any single character of the characters within the []. To specify a range of the characters, list the starting and ending character separated with a dash (-), as in [a-z].
[^] Any single character not in the set Matches any character not in the set of characters following the ^.
| Or Matches either the expression before or the one after the OR symbol (|). Mostly used within a group. For example, (database|management)system matches “database system” and “management system”.
\ Escape Special Character Matches the character that follows the backslash (\) as a literal. This allows you to find characters used in regular expression notation, such as { and ^. For example, \^ searches for the ^ character.
{} Tagged expression Matches text tagged with the enclosed expression.
:i SQL identifier Matches the expression ([a-zA-Z_$][a-zA-Z0-9_$]*).
:q Quoted string Matches the expression ((“[^”]*”)|(‘[^’]*’)).
:b Space or Tab Matches either space or tab characters.
:z Integer Matches the expression ([0-9]+).

Wildcards for Find and Replace

The Find and Replace window contains a list of expressions to replace characters or digits in the Find what field. They are called Wildcards.

To select the required wildcard, do the following:

  1. In the Find and Replace window, select the Use check box and choose Wildcards from the drop-down list. The Expression Builder button next to the Find what field becomes active.
  2. Click the Expression Builder button and select a wildcard from the drop-down list. It is inserted into the Find what field.

The drop-down list contains the following wildcards:

Syntax Expression Description
? Any single character Matches any single character.
# Any single digit Matches any single digital. For example, 5# matches numbers that include 5 followed by another number, such as 51, but not 15.
[!] Characters not in set Matches any single character that is not specified in the set.
\ Escape Matches the character that follows the backslash () as a literal. This allows you to find the characters used in wildcard notation, such as * and #.
* One or more characters Matches any single or more characters. For example, test* matches any text that includes “test”, such as testfile.txt.
[] Set of characters Matches any single character of the characters specified in the set.