Editing Commands

Selecting Text

Feature Access Notes
Any string Mouse: Place cursor and drag  
Word Mouse: Double-click  
Line Mouse: Triple-click  
Rectangle
Column
Mouse: Ctrl+drag  
Select All Menu: Edit > Select All
Keys: Ctrl+A
 

Undoing/Redoing Changes

Feature Access Notes
Undo Menu Edit > Undo
Keys: Ctrl+Z
Keeps a list of the 400 most recent changes to undo/redo.
Redo Menu: Edit > Redo
Keys: Ctrl+Z
Keeps a list of the 400 most recent changes to undo/redo.

Cutting and Pasting Text

Feature Access Notes
Cut Menu: Edit > Cut
Keys: Ctrl+X
 
Copy Menu: Edit > Copy
Keys: Ctrl+C
 
Paste Menu: Edit > Paste
Keys: Ctrl+V
 
Paste Column Menu: Edit > Paste Column
Keys: Ctrl+V
 
Clear Menu: Edit > Clear
Keys: Delete
 
Replace with existing Mouse: Select text to replace; Middle-drag replacement text  
Move existing Mouse: Left-click to select new location; Middle-drag text to move  

Indenting Text

Feature Access Notes
Shift Left Menu: Edit > Shift Left
Keys: Ctrl+[
Moves selected text one tab to the left.
Shift Right Menu: Edit > Shift Right
Keys: Ctrl+]
Moves selected text one tab to the right.

Finding and Replacing Text

Feature Access Notes
Find Menu: Search > Find...
Keys: Ctrl+F
Dialog allows you to specify literal, literal case-sensitive or regular expression search. The default is set in Cosmo code preferences (File > Preferences > Source.) You can keep the dialog open for multiple searches using the Keep Dialog checkbox or the Keep Search Dialogs Up preference. Verbose Search preference provides information dialogs on search progress. Default is to beep when no match is found.
Find Again Menu: Search > Find Again
Keys: Ctrl+G
Finds additional occurrences of the string or expression typed into the Find dialog or the string found using Find Selection.
Find Selection Menu: Search > Find Selection
Keys: Ctrl+H
Select a region of text, then use Find Selection to find other occurrences of the selected region.
Replace Menu: Search > Replace...
Keys: Ctrl+R
 
Replace Same Menu: Search > Replace Same
Keys: Ctrl+T
 
Goto Line Number Menu: Search > Goto Line Number
Keys: Ctrl+L
 
Mark Menu: Search > Mark
Keys: Alt+M
Opens a dialog to identify a location in the file using a single character.
Goto Mark Menu: Search > Goto Mark
Keys: Alt+G
Opens a dialog to enter a defined mark or location to display.

Working with Shell Commands

Feature Access Notes
Filter Selection Menu: Command > Filter Selection
Keys: Alt+L
When text is selected in the Source panel, allows you to specify a shell command to filter the selected text. The output from this command replaces the contents of the selection.
Execute Command Menu: Command > Execute Command...
Keys: Alt+Y
Opens a dialog to enter a shell command to execute. Results are added to the source file at the cursor location.
Cancel Shell Command Menu: Command > Cancel Shell Command
Keys: Ctrl+,
 
Edit Shell Commands Menu: Command > Edit Shell Commands...
Opens an Edit Shell Menu dialog to add items to, or make changes to, the shell-related items on the Command menu.

Working with Macros

Feature Access Notes
Learn Keystrokes Menu: Command > Learn Keystrokes
Keys: Alt+K
Begins recording a macro. Select this menu item, record the steps to include in the macro, then choose Finish Learn. choose Replay Keystrokes to reply the macro. You can add the macro to the Command menu using Edit Macro Commands....
Finish Learn Menu: Command > Finish Learn
Keys: Alt+K
Ends the recording of the macro. To be used in conjunction with Learn Keystrokes.
Cancel Learn Menu: Command > Cancel Learn
Keys: Ctrl+.
Cancels the recording of a macro.
Replay Keystrokes Menu: Command > Replay Keystrokes
Keys: Ctrl+K
Plays a macro.
Edit Macro Commands Menu: Command > Edit Macro Commands...
Opens an Edit Macro Menu dialog to add items to, or make changes to, the macro-related items on the Command menu.

Miscellaneous Commands

Feature Access Notes
Insert file Menu: File > Insert File...
Keys: Ctrl+I
Inserts a file into the currently -displayed source file at the point of the cursor.
Capitalize Menu: Edit > Capitalize
 
Lower Case Menu: Edit > Lower Case
 
Match parentheses Menu: Search > Match Parenthesis
Menu: File > Preferences >Source
Keys: Ctrl+M
Highlights matching parentheses.

Edit Shell Menu Dialog

For steps on creating a shell command and adding it to the Command menu, see Using Shell Commands.

Field Description
Shell menu items list box Displays a list of existing user-defined shell command menu items. Select an item to modify it. Select New to create a new menu item.
Menu Entry The name of the shell command as it appears on the Command menu.
Accelerator The accelerator for the shell command. With the cursor over the field, press the keys you want to use an an accelerator.
Mnemonic A mnemonic for the shell command. Type in a single character mnemonic.
Command Input

Select the appropriate radio button to determine where command input will be entered:

  • selection--input comes from the currently highlighted text
  • window--input comes from the current source file
  • either--uses selected text, or if no text is selected, uses the window
  • none--for commands that do not require input
Command Output Select whether you want output from the command to go to the insertion point in the currently displayed source file (same window) or to a separate window (dialog).
Shell Command to Execute Type in the shell command to execute, using % to refer to the filename currently displayed in the Source panel.
Add Adds a newly created shell command to the menu.
Change Changes the selected shell command as you have specified in the Edit Shell Menu dialog.
Delete Deletes the shell command from the Command menu.
Move ^ Moves the selected shell command up in the menu.
Move v Moves the selected shell command down in the menu.
Undo Undoes the most recent change.
Close Closes the dialog.

Edit Macro Menu Dialog

For steps on creating a macro and adding it to the Command menu, see Creating and Using Macros.

Field Description
Macro menu items list box Displays a list of existing user-defined macro menu items. Select an item to modify it. Select New to create a new menu item.
Menu Entry The name of the macro as it appears on the Command menu.
Accelerator The accelerator for the macro. With the cursor over the field, press the keys you want to use as an accelerator.
Mnemonic A mnemonic for the macro. Type in a single character mnemonic.
Paste Learn/Replay Macro Click this button to paste a macro recorded using Command > Learn Keystrokes into the "Macro Command to Execute" field.
Macro Command to Execute Displays a macro you have pasted into the field using the Paste Learn/Replay Macro button, and allows you to edit the macro or type in your own macro using the supported action routines.
Add Adds a newly created macro to the menu.
Change Changes the selected macro as you have specified in the Edit Macro Menu dialog.
Delete Deletes the macro from the Command menu.
Move ^ Moves the selected macro up in the menu.
Move v Moves the selected macro down in the menu.
Undo Undoes the most recent change.
Close Closes the dialog.

Regular Expressions

Regular expressions can be used in two ways:

Here's an example of fairly complex find and replace regular expressions. The search string finds occurrences of get_x:

  get_x\(([^ ,]*), ([^\)]*)\)

The replace string reverses the first and second parameters, adds a third parameter of NULL, and changes the name to new_get_x:

  new_get_x(\2, \1, NULL)

Regular Expression Syntax

Syntax Description
| A regular expression consists of zero or more branches, separated by `|', and matches anything that matches one of the branches.
. Matches any single character.
^ Matches the null string at the beginning of a line string.
$ Matches the null string at the end of a line.
\ When followed by a single character, matches that character.
char A single character with no other significance matches that character.
\t Matches a tab.
\n Matches a newline.
\b Matches a backspace.
\r Matches a carriage return.
\f Matches a formfeed.
(regular_expression) Where regular_expression is a regular expression, matches a match for the regular expression.
* Matches a sequence of 0 or more matches of the preceding unit.
+ Matches a sequence of 1 or more matches of the preceding unit.
? Matches a match of the preceding unit, or the null string.
[ chars] Where chars is a sequence of characters, a range that normally matches any single character from the sequence. If the sequence begins with `^', it matches any single character not from the rest of the sequence. If two characters in the sequence are separated by `-', this is shorthand for the full list of ASCII characters between them (e.g. `[0-9]' matches any decimal digit). To include a literal `]' in the sequence, make it the first character (following a possible `^'). To include a literal `-', make it the first or last character.
& When used in a substitution string, the entire string that was matched in the find operation is substituted.
\num Where num is a a digit 1 through 9, inserts up to nine sub-expressions of the match string into the replacement string. \1 through \9 represent the strings that matched parenthesized expressions within the regular expression, numbered left-to-right in order of their opening parentheses.
\U, \u, \L, \l Preceding & or \1-9, adjusts the case of the inserted text. \u and \l change only the first character, while \U and \L change the entire string to upper or lower case.

Guide to the Cosmo Code Development Environment
12-96*288