WORKING WITH TEXT
11.4 WORKING WITH TEXT
The following editor features are available for working with text: • Selecting Text
• Moving to a Specific Line • Cutting/Deleting Text • Copying Text • Pasting Text • Finding Text • Replacing Text • Matching Braces • Undoing Editor Actions • Redoing Editor Actions • Indent and Outdent • Formatting Text
11.4.1 Selecting Text
To select any block of characters: • With the mouse:
- Click the mouse at one end of the text you wish to select. - Hold down the left mouse button and move the mouse cursor to the other end
of the text. - Release the left mouse button. The text you selected is now highlighted. • With the keyboard: - Using the navigation keys, move the text cursor to one end of the text you
wish to select. - Hold down a shift key and move the text cursor to the other end of the text. - Release the shift key. The text you selected is now highlighted.
To select a whole word or line: Note: This function is available if you do not have “Double-click Toggles
Breakpoint” checked in the Editor Options. • Word: Double-click the word you want to select. The word is now highlighted.
• Line: Double-click a word in the line you want to select. Then click again. The line is now highlighted.
To select the entire contents of the file: Press <CTRL> + <A> or select Select All from the Edit menu. The entire buffer is now
highlighted. Note: If you move the cursor after selecting text, the text will no longer be
selected.
DS51519A-page 156
2005 Microchip Technology Inc.
Using the Editor
11.4.2 Moving to a Specific Line
No matter where the cursor is in a file, you can quickly move it to any line that you specify.
To move to a specific location in the active window:
1. Select Goto Line from the Edit menu or press <CTRL> + <G>. A Goto Line dialog displays.
2. Enter the line number in the dialog and click the OK button. The editor will move the cursor to the specified line and scroll to display the line, if necessary.
Note: If you enter a number larger than the number of lines in the file, the cursor
will move to the last line in the file.
11.4.3 Cutting/Deleting Text
To cut text:
1. Select the text to cut.
2. Click the Cut icon, select Cut from the Edit menu, press <CTRL> + <X> or press <Shift> + <Delete>.
The selected text is deleted from the source document but moved to the Windows clipboard so that it may be pasted elsewhere.
To delete text:
1. Select the text to delete.
2. Select Select from the Edit menu or press <Delete>. The selected text is deleted from the source document. If you deleted in error,
immediately perform an Undo. To remove single characters:
1. To remove the character to the left of the caret, press <Backspace>.
2. To delete the character under the caret, press <Delete>.
11.4.4 Copying Text
To copy text:
1. Select the text you want to copy.
2. Click the Copy icon, select Copy from the Edit menu, press <CTRL> + <C> or press <CTRL> + <Insert>.
To copy a column of text:
1. Place the cursor at a corner of the text column you want to copy.
2. Hold down the Alt key and then click-and-drag with the mouse to select the text column.
3. Click the Copy icon, select Copy from the Edit menu, right-click on the selection and choose Copy, press <CTRL> + <C> or press <CTRL> + <Insert>.
Note: If the wrong column is highlighted, make sure your cursor is on the same
line as your mouse pointer for proper selection. The selected text is copied to the Windows clipboard so it can be pasted elsewhere.
2005 Microchip Technology Inc.
DS51519A-page 157
MPLAB ® IDE User’s Guide
11.4.5 Pasting Text
You can paste any text contained in the Windows clipboard into a file in the MPLAB editor. You can paste text that you have copied from the same file or from another application. Text must exist in the Windows clipboard before it can be pasted.
To paste text from the Windows clipboard:
1. Move the caret to the point where you want to insert the text.
2. Click the Paste icon, select Paste from the Edit menu, press <CTRL> + <V> or press <Shift> + <Insert>.
Note: Pasting text does not remove it from the clipboard; you may paste it multiple
times.
11.4.6 Finding Text
To find text in a file:
1. Make sure the file you want to search is open in the active window.
2. Select Find from the Edit menu or press <CTRL> + <F>. The Find dialog displays.
3. If you selected text before opening the Find dialog, that text is displayed in the “Find What” field. If the text you want to search for is not displayed in the “Find What” field, enter the text you want to find or select a previously found text string from the drop-down list.
4. Select any of the Find options in the dialog that you want to use for this search. These options are:
- Match whole word only - Match case - Direction – Up - Direction – Down
5. Click Find Next. The editor will move the caret to the next (previous) matching text in the file. If there is no such text, the editor will display a message saying so.
To repeat the previous find: Press <F3>, or, if the Find dialog is still up, click Find Next. To repeat the previous find
in the opposite direction, press <Shift> + <F3>.
DS51519A-page 158
2005 Microchip Technology Inc.
Using the Editor
11.4.7 Replacing Text
To find and replace text in a file:
1. Make sure the file you want to edit is open in the active window.
2. From the Edit menu, select Replace or press <CTRL> + <H>.
3. If you selected text in the file before opening the Replace dialog, that text is displayed in the “Find What” field. If the text you want to replace is not displayed in the “Find What” field, enter the text you want replace.
4. In the “Replace With” field, enter the replacement text.
5. Select any of the Find/Replace options in the dialog that you want to use for this search. These are:
- Match whole word only - Match case
6. Click: - Find Next to do a simple find - Replace to replace the closest matching text - Replace All to replace all matching text - Cancel to close the dialog with no further action.
To repeat a Replace operation:
1. Press <F3>.
2. If the Find/Replace dialog is still open, click Replace. The most recently performed Find/Replace operation is executed, including all
Find/Replace options that were selected.
11.4.8 Matching Braces
To recognize a section of bracketed text:
1. Move the caret to an opening/closing symbol.
2. Press <CTRL> + <M>, select Edit>Match or right-click in the edit window and select Advanced>Match. The cursor will move to the matching symbol.
Opening/closing symbols are: [ ] { } ( ) < >
11.4.9 Undoing Editor Actions
If you have just made a change to a file, you can reverse the effect of the last change you just made.
• Select Undo from the Edit menu or press <CTRL> + <Z>. You can repeat the Undo action multiple times in succession. Each will undo the action
prior to the last undo.
11.4.10 Redoing Editor Actions
If you have just reversed a change with the Undo function, you can redo the change. • Select Redo from the Edit menu or press <CTRL> + <Y>.
You can repeat the Redo action multiple times in succession.
11.4.11 Indent and Outdent
You may indent or outdent text by the tab width specified in Edit>Properties>Editor Options, Tabs tab. Then use <Tab>/<Shift>+<Tab> or Indent Block/Outdent Block commands (Right-click menu, Advanced.)
2005 Microchip Technology Inc.
DS51519A-page 159
MPLAB ® IDE User’s Guide
11.4.11.1 INDENTING Tabs or spaces will be inserted as specified in the Editor Options dialog.
Single line
1. Move the caret to the start of the line you want to indent.
2. Make sure the editor is in Insert mode
3. Press <Tab> once for each level you want to indent the line. Auto Indent New line automatically indented like the previous line. Block of lines
1. Select the lines in the block you want to indent.
2. Press <Tab> once for each level you want to indent the lines in the block.
11.4.11.2 OUTDENTING Single line
1. Move the caret to the start of the line you want to outdent.
2. Press <Shift> + <Tab> once for each level you want to outdent the line. Block of lines
1. Select the lines in the block you want to outdent.
2. Press <Shift>+<Tab> key once for each level you want to outdent the lines in the block.
Note: You cannot outdent a line backwards through column 1.
11.4.12 Formatting Text
You can format text from options selected in the context (right-mouse) menu. • Right-click menu, Text Mode. Format all text according to the syntax of your
selected assembler or compiler and device. • Advanced>Format Text. Make all selected text either all uppercase or all
lowercase. • Properties, Editor Options dialog. Set up the file (editor) window.
DS51519A-page 160
2005 Microchip Technology Inc.
Using the Editor