[Front] [Prev Chapter] [Next Chapter]

Chapter 6 Editing Text Files

Starting EDIT

Using EDIT

Moving the Cursor

Deleting Text

Working With Blocks of Text

Saving Your Work

Using Markers

Searching for and Replacing Strings of Text

Quitting EDIT

Automatic Backup Files

Technical Details

Command Summary


This chapter describes how to use EDIT, a menu-based editor which you can use to create and edit text files. You can use a keyboard or mouse, and there are shorthand forms for some of the common commands, including WordStar* compatible commands. You can use EDIT to do the following:

Starting EDIT

To start the operating system editor from the system prompt, type the following:

EDIT <Enter>

The EDIT menu interface displays, showing the Select File to Edit dialog box. The current drive and directory shows in the Files field. The Files window displays a list of the files in the current directory, and the Dir and Drives window displays the subdirectories and the available drives.

EDIT has on-line help available; press <F1> to use it, or select the <Help> button.

There are three ways you can select a file to open within EDIT.

1. Type the filename, including the path if the file is in a different directory, in the File field. To open the file, press <Enter>, or use the mouse to point to the <OK> button and click to select it, or press <Tab> three times to highlight the <OK> button and press <Enter> to select it.

NOTE: If the filename you enter does not exist, EDIT recognizes this and prompts you to choose whether or not to create the file. Select <OK> if you want to create the file. Select <Cancel> if you do not want to create the file. EDIT returns you to the Open File dialog box.

2. Move to the Dir and Drives window using the mouse or <Tab> key. Select a drive or directory by scrolling through the list, using the <up-cursor> and <down-cursor> keys until you reach the drive or directory you require. Note that as you scroll through the list, the entry in the File field changes to reflect which directory or drive is highlighted in the window.

Press <Shift><Tab> to move back to the Files window. Scroll through the list of files until you find the file you wish to open. Note that the filename in the File field changes as you scroll through the list. Once the correct filename appears in the File field, select <OK> using the mouse, or by pressing <Tab> twice and then <Enter>.

NOTE: If you type EDIT at the system prompt followed by the path, if needed, and name of a file, EDIT opens that file directly, and does not display the Open File dialog box. If the file does not exist, EDIT prompts you to choose whether or not the file is created. Select <OK> to create it, or <Cancel> to edit a different file.

3. If the file already exists, move the mouse pointer to the filename you want in the list of files and double-click the mouse button.

Using EDIT

To enter text, type as you would using a word processor or typewriter except, when you reach the end of a line, press <Enter> to start a new line. This is because in EDIT there is no "word wrap"; it does not automatically start a new line unless you tell it to do so.

Notice that as you type, at the bottom of the screen, EDIT displays how many characters and columns you are entering, for example:

Chr=108 Col=3

This tells you the current position of the cursor. The directory path and filename are also displayed at the bottom of the screen.

There is a scroll bar at the right side of the EDIT screen. Move the mouse pointer over the scroll bar slider and drag the slider up and down to move through the file.

Inserting and Overwriting Text

EDIT has two modes for entering text: insert (ins) and overwrite (ovr). When you start EDIT, you are automatically in insert mode. The message ins is shown at the bottom right corner of the screen.

When you enter text in insert mode, existing text moves to the right as you type.

To switch to overwrite mode, press <Ins> or <Ctrl> V. In overwrite mode, if you position the cursor at the point where the new text is to start and begin typing, any existing text is overwritten.

To switch to insert mode again, press <Ins> or <Ctrl> V again.

NOTE: Remember that if ins is at the bottom of the screen, you are in insert mode. If ovr is displayed, you are in overwrite mode.

At the top of the screen is the menu bar. To open a menu, use the mouse to point to the menu name and click on it, or press <Alt> and the initial letter of the menu name. To choose an option from the menu, use the mouse to point to the option and click on it, or move the highlight bar over the option using the <up-cursor> and
<down-cursor> keys and press <Enter>. You can also type the highlighted letter from the option to select it.

You can select menu options that are followed by <Alt><character> by pressing the <Alt> key and the given character without opening the menu first.
File menu

Open... <Alt> O

Opens a new file.

Read <Alt> R

Reads another file into the current file at the current cursor position.

Save <Alt> V

Saves the current file.

DOS shell <Alt> D

Lets you access the DOS system prompt without quitting EDIT.

Exit <Alt> X

Exits EDIT.

Block menu

Start

Marks the start of the block at the current cursor position.

End

Marks the end of the block at the current cursor position.

Hide/Show

Hides/reveals the block highlight.

Copy

Copies the marked block of text.

Move

Moves the marked block of text.

Delete <Del>

Deletes the marked block of text.

Write to file...

Writes the marked block of text to a file.

Search menu

Search for string

Searches for the specified text string.

Search and replace

Searches for the specified text string and replaces it with another.

Repeat last search <F3>

Performs the previous search again.

Help menu

Help for help

Displays help information on using EDIT online help.

Contents

Displays the list of contents for EDIT online help.

Previous topic

Displays the last help topic read.

DOSBook

Displays DOSBook, the online manual for the operating system.

About...

Displays copyright information.

Moving the Cursor

You can move the cursor around your file in steps of one character, one word, or one page, or you can jump directly to the start or end of the file.

To Move the Cursor One Character

To Move the Cursor One Word

The keys A and F are also part of the "cursor-control diamond."

To Move the Cursor One Page

A "page" is the number of lines displayed on your screen. When you move down a page, some of the previous page will still be displayed on the screen, to make it easier for you to find your place again.

To Move the Cursor to the Start or End of a Line

To Move the Cursor to the Start or End of a File

Using the Tab Key

You can use the <Tab> key to move the cursor across the page and insert text at set points. The tab stops are preset to every eighth column across the screen. You can think of the <Tab> key as meaning "add space characters until you reach the next tab stop."

Moving Text Down a Line

If you press <Ctrl> N when editing text, the rest of the line at the cursor is taken down to the next line, while the cursor remains where it is.

Scrolling Through the Text

You can also use the scroll bar at the right hand side of the EDIT screen to move through the text. Move the mouse pointer to the scroll bar slider, click on the slider, and move the slider up or down. The text scrolls, corresponding to the movement of the slider.

Inserting a File at the Cursor

To read in a file, place the cursor where you want the file to be inserted, open the File menu and select Read, or press <Alt> R. You can also press <Ctrl> KR. The Select File to Read dialog box displays.

Either type in the name of the file you want to insert, or select it from the Files window, and press <OK>. The file is inserted at the cursor. The remaining text is moved down to accommodate the new text.

Deleting Text

Text can be deleted a character at a time, a word at a time or one line at a time. (You can also delete blocks of text; see "Working With Blocks of Text" on page 6-9.)

Deleting a Character


The character is deleted from the screen, and the text to the right of the cursor shifts to the left to fill the gap.

If you press <Delete> or <Ctrl> G repeatedly, characters will continue to be deleted until you reach the end of the file.


The character is deleted from the screen and the text to the right of the cursor shifts to the left to fill the gap.

If you press <Backspace> or <Ctrl> H repeatedly, characters continue to be deleted until you reach the beginning of the file.

If you press <Delete> at the end of a line, you delete the invisible "newline" character and bring up the next line. Similarly, pressing <Backspace> or <Ctrl> H at the beginning of a line moves that line up to the end of the previous line.

NOTE: If you want to delete more than one character, it is usually quicker to use one of the key combinations described in the following sections.

Deleting a Word

In EDIT a "word" is defined as a string of characters that starts at the current cursor position and continues up to and including the first following space.

Deleting a Line

Position the cursor anywhere in the line to be deleted and press <Ctrl> Y. The line is deleted and lines below it move up to fill the gap.

NOTE: On some keyboards, the keys G, H, T and Y (for deleting characters, words and lines) are next to each other and form an approximate square. You may find this helps you to remember these commands.

Working With Blocks of Text

You can mark a section or block of text and then move, delete, copy, or store it into a separate file. A block of text can be any size (according to how much disk space you have).

Marking a Block of Text

To mark a block of text, place the cursor at the start of the section you want to mark, open the Block menu, and select the Start command to set the start of the block. You can also press <Ctrl> KB. The text is marked with <B>. Move the cursor to the end of the block of text, open the Block menu, and select the End command. You can also press <Ctrl> KK. The end of the text block is marked with <K> and the text block is highlighted.

You can also use the mouse to mark a block of text. Move the mouse pointer to where you want the block to start and drag the mouse to where you want the block to end.

Moving a Block of Marked Text

To move a block of marked text, place the cursor where you want the block to be moved to, open the Block menu, and select the Move command. You can also press <Ctrl> KV. The text is erased from its original position and moved to where the cursor is. The text moves up to fill the gap.

Deleting a Block of Marked Text

To delete a block of marked text, open the Block menu, and select the Delete command. You can also press <Ctrl> KY or <Del>, the Delete key. The text is deleted and the text beneath it moves up to fill the gap.

Copying a Block of Marked Text

To copy a block of marked text, move the cursor to where you want the block of text copied, open the Block menu, and select Copy. You can also press <Ctrl> KC. The block of text is copied to the cursor position, still marked. The original text remains where it is and is no longer marked.

Storing a Block of Marked Text in a File

To store a block of marked text in a separate file, open the Block menu, and select Write to file.... You can also press <Ctrl> KW. The Select File to Write dialog box displays.

Either enter the name of the file where the text is to be stored in the File field or select a path, if needed, and filename from the list in the Files window, and select <OK>. The file is created and the block of marked text is written to it. If the file already exists, you are asked:

File already exists, overwrite?

Select <OK> to overwrite the file, <Cancel> if you want to keep the file as it is. If you select <Cancel>, no action is taken; open the Block menu, and select Write to file... or press <Ctrl> KW again and enter a different filename.

Hiding the Highlight Block

Once you have set the block markers, you can switch the highlight for the block on or off. Open the Block menu and select Hide, or press <Ctrl> KH. The highlight block disappears. To redisplay the highlight block, use the Show command which replaces the Hide command in the Block menu, or press <Ctrl> KH again.

NOTE: When a block of text is hidden, you cannot copy, move or delete it.

Saving Your Work

To save changes you have made to a file, open the File menu and select Save, or press <Alt> V. EDIT saves the changes and updates the backup file (see "Automatic Backup Files" on page 6-14). You can then carry on editing your file. You can also press <Ctrl> KS to save changes and resume editing the file.

If you want to save your work and start work on a different file, then open the File menu and select Open... or press <Alt> O. The Select File to Edit dialog box displays. Either type the name of the new file, or select an existing file from the Files window.

If you have made changes to the file you were working on previously, EDIT detects this, and before opening the new file, EDIT prompts you to choose whether or not to save the current file. Select <Yes> to save it, or <No> to abandon any changes.

You can also press <Ctrl> KD to save changes to a file and start editing a new file.

To save changes and exit from EDIT, open the File menu and choose Save and then Exit, or press <Alt> V, followed by <Alt> X. You can also press <Ctrl> KX to save changes and exit EDIT directly.

Using Markers

You can insert markers that act as "bookmarks" in a text file. The maximum number of markers you can insert is 10. Once a marker is placed at a particular point in the text, a simple key combination returns you to that point in the text.

Inserting a Marker

To insert a marker in the text, move the cursor to where you want to place the marker. Press <Ctrl><F1> to set the first marker. You can also set the marker by pressing <Ctrl> K<1> where <1> is on the numeric keypad. To set subsequent markers, press <Ctrl><Fn>, or <Ctrl> K<n>, where <Fn> is the next function key up to <F10>, and <n> is the next number on the numeric keypad up to <0>.

Moving to a Preset Marker

To return to a marker already set in the text, press <Alt><Fn> where <Fn> is the function key you used to set the marker, or press
<Ctrl> Q<n> where <n> is the number on the numeric keypad you used to set the marker.

Note that any markers set in a file are lost when you either quit editing that file and open a new file, or exit from EDIT.

Searching for and Replacing Strings of Text

You can search for strings of text in EDIT, and replace them with another string.

Searching for a String of Text

To search for a string of text, press <Alt> S to open the Search menu and select the Search for string option, or press <Ctrl> QF. The Search dialog box displays. Enter the string which you wish to find in the Search string field.

You can set the following options on a text string search:

Searching for and Replacing a Text String

To search for a text string and replace it with another, press <Alt> S to open the Search menu and select the Search and replace option, or press <Ctrl> QA.

The Search and Replace dialog box displays. Enter the text string in the Search string field and the replacement text string in the Replacement string field.

The options listed previously are also available in this dialog box as well as the following:

Select this option if you do not want to confirm each replacement each time the search string is found.

Repeating the Previous Search

You can repeat a search by opening the Search menu and selecting the Repeat last search option, or by pressing <Ctrl> L or <F3>. The most recent search is repeated with the same options set. Note that if you have set the Begin search at file start option, then repeating the search finds the first occurrence of the text string in the file, not the next occurrence from the cursor position.

Quitting EDIT

To quit EDIT, open the File menu and select the Exit command, or press <Alt> X.

If you have made changes to a file EDIT prompts you to choose whether to save the changes or not. Select <Yes> to save the changes and exit from EDIT, or <No> to abandon the changes and exit. Select <Cancel> if you do not want to exit from EDIT.

You can also press <Ctrl> KX to exit EDIT and save changes, or
<Ctrl> KQ to exit and abandon changes.

Automatic Backup Files

When you open an existing file, a "working copy" of the file is stored in memory. The original file remains on your disk, unaltered.

When you save your edited file, the working copy is stored on the disk and is given the name of the original file. The old file becomes an EDIT backup file with the extension .BAK.

Example

If you open the file MYTEXT.DOC and edit it, when you save the file the following happens:


You can use backup files to recover files: if the current version is found to be incorrect or accidentally erased, for example.

If you accidentally deleted the file MYTEXT.DOC, you could revert to the .BAK file by typing:

COPY MYTEXT.BAK MYTEXT.DOC <Enter>

To prevent any filename conflicts, EDIT does not allow you to edit files with the extension .BAK.

Before you start editing a file, make sure that there is enough free space on the disk to store both the original file with the .BAK extension, and the edited version of the file.

Technical Details

Writing to the Screen

EDIT writes direct to the screen memory (rather than via BIOS calls) if you have an EGA or VGA display. For all other display types, EDIT writes to the screen via BIOS calls. However, you can force EDIT to write via BIOS calls regardless of the display type by invoking EDIT with the /D switch:

EDIT /D <Enter>

Command Summary

Table 6-1
Summary of EDIT Commands

Function

Keys

Getting Help

Displays help text

<F1>
<Alt> H

<Ctrl> J

Help

Moving the Cursor

Start of file

<Ctrl><Home>

<Ctrl> QR

End of file

<Ctrl><End>

<Ctrl> QC

Start of the line

<Home>

<Ctrl> QS

End of the line

<End>

<Ctrl> QD

Character left

<left-cursor>

<Ctrl> S

Word left

<Ctrl><left-cursor>

<Ctrl> A

Character right

<right-cursor>

<Ctrl> D

Word right

<Ctrl><right-cursor>

<Ctrl> F

Previous line

<up-cursor>

<Ctrl> E

Next line

<down-cursor>

<Ctrl> X

Scroll text down one line

<Ctrl> <Ctrl> W

Scroll text up one line

<Ctrl> <Ctrl> Z

Previous page

<PgUp>

<Ctrl> R

Next page

<PgDn>

<Ctrl> C

Deleting Text

Delete character

<Del>

<Ctrl> G

Delete line

<Ctrl> Y

Delete character to the left

<Backspace>

<Ctrl> H

Delete word to the right

<Ctrl> T

Working with Blocks of Text

Mark the start of a block of text

<Ctrl> KB

Start

Mark the end of a block of text

<Ctrl> KK

End

Move a marked block of text

<Ctrl> KV

Move

Delete a marked block of text

<Del>

<Ctrl> KY

Delete

Copy a marked block of text

<Ctrl> KC

Copy

Store a marked block of text in a file

<Ctrl> KW

Write to file

Hide the block markers and highlight

<Ctrl> KH

Hide/Show

Saving Files

Save changes, exit

<Alt> V
<Alt> X

<Ctrl> KX

Save
Exit

Save changes, edit new file

<Alt> V
<Alt> O

<Ctrl> KD

Save
Open

Save changes, resume editing

<Alt> V

<Ctrl> KS

Save

Abandon changes, edit new file

<Alt> O

<Ctrl> KQ

Open

Using Markers

To insert a marker

<Ctrl> <Fn>

<Ctrl> K<n>

To go to a marker

<Alt> <Fn>

<Ctrl> Q<n>

Other Commands

Switch between insert and overwrite

<Ins>

<Ctrl> V

Read in a file at the cursor

<Alt> R

<Ctrl> KR

Read

Insert a new line at the cursor

<Enter>

Insert a new line after the cursor

<Ctrl> N

Insert a control character at the cursor

<Ctrl> P

Enter character codes directly into a file

<Ctrl> QN

Go to the DOS shell

<Alt> D

DOS Shell

Search for a specified text string

<Ctrl> QF

Search for string

Search for and replace a specified text string

<Ctrl> QA

Search and replace

Repeat the previous search

<F3>

<Ctrl> L

Repeat last search



[Front] [Prev Chapter] [Next Chapter]

info@caldera.com
Copyright © 1993, 1997, 1998 Caldera, Inc. All rights reserved.