


===============================================
                   Chapter 4

  INTRODUCING SOME ADVANCED EDITING FUNCTIONS
===============================================


4.1  Search And Replace

4.1.1  Searching for Text

     CygnusEd Professional provides an easy way of locating a particular
string or character in a file.  The Search function accepts a string of
characters and several different search type modifiers and looks in the
direction indicated for the next occurrence of the string.

     When you select the SEARCH FOR... function, a search requester
appears.  If has four boolean or "toggle" gadgets and a string gadget.  The
string gadget is active when the requester appears (you can tell when a
string gadget is active when you can see a cursor in it).  You can
immediately type in the string of characters you wish to look for.

     When you press RETURN in the string gadget, the requester will
disappear and CygnusEd Professional will move your cursor to the next
occurrence of the string.  If no match is found, CygnusEd Professional will
report in a little requester that it could not find the string.  Click on
the "Resume" gadget or press the letter Y to make the requester go away.
(Notice that the requester will appear as close to your mouse cursor as
possible.  This is just one more way in which we've tried to make CygnusEd
Professional a little easier to use!)

                                  Page 21

----------------------------------------------------------------------------



     The REPEAT SEARCH commands will search for the next occurrence of the
save string as was last indicated with the SEARCH FOR... command.  There
are separate REPEAT SEARCH commands for searching backwards and forwards.

     Several modifiers are available for the search function.  These are
described below.


4.1.2  UC == LC

     This modifier determines case sensitivity.  If the gadget is
highlighted (filled with a color other than the background color), then
upper case is treated the same as lower case, that is, the case of the
character does not matter.

     If the gadget is not highlighted, the search will be case sensitive,
so "That" will not match with "THAT".


4.1.3  Wild Cards

     CygnusEd Professional provides a single wildcard for the search
function.  The character "*", the asterisk, will match with any single
character when wildcards are turned on.  When the gadget "Wild Cards" is
highlighted, any asterisk entered in the search string gadget is considered
a wild position.

     For example, to match $100, $200, $300 ... $900, you could use the
wildcard string $*00.  This would find all dollar signs followed by any one
character followed by two zeroes.

     If the gadget is not highlighted, the asterisk will only match an
asterisk in the file.  (i.e., the asterisk is a literal and is not treated
as a wild card).


4.1.4  Direction

     The gadget "Forwards" indicated the direction of the search.  The
search always begins at current cursor location.  If this gadget is
highlighted, the search will proceed from one character past the current
cursor position towards the end of the file.  If the gadget is not
highlighted, the search will progress towards the beginning of the file,
starting on the character just before the cursor.

                                  Page 22

----------------------------------------------------------------------------



4.1.5  Only Words

     The "Only Words" modifier will tell CygnusEd Professional to match the
next occurrence of the string specified as long as it is a whole word.  In
effect, this means that you can search for "the" without also finding
"then", "bathe", or "lather".  The benefits of this for Document Processors
is readily apparent.

     This is useful for programmers, as well, who have used a short
variable name like "i" and would like to replace it with something
meaningful without also replacing all of the 'i's in their 'if' and 'while'
statements.


4.1.6  Shortcuts In The Search Requester

     Note that a specialized menu is available when the search requester is
being displayed.  There is a menu item for each of the toggle gadgets.  By
using the associated keyboard shortcuts the state of each gadget can be
controlled from the keyboard without having to resort to the mouse.

     To exit the requester without searching, you can hit the close window
gadget, the 'LEAVE' menu selection or AMIGA-L.  All the normal Intuition
string gadget functions are also supported, such as AMIGA-Q, for undo.  For
a complete list of the Intuition commands, see section 7.2, Controlling the
File Requester With the Keyboard.  For a complete list of CygnusEd
Professional keyboard shortcuts please see the KEYBOARD COMMANDS AND
SHORTCUTS section.


4.1.7  Replacing Text

     The Replace function is tied in closely with the Search function.  You
must specify the string to be sought in the first string gadget and the
replacement string in the second string gadget.

     All the same modifiers that are available for search are also
available for the replace function.  Note:  When searching using wildcards,
the replacement does not know about the original, so if you specify wild
card replacement from th*n to t*p, then the strings "than" and "then" will
be replaced with "t*p".  I.E., the asterisk is always literal in the
replacement string gadget.

                                  Page 23

----------------------------------------------------------------------------



     When you press RETURN in the replacement string gadget, CygnusEd
Professional will search for the next occurrence of the original string and
will position the cursor there.  The title bar of the view will change to
read "(Y)es/(N)o/(L)ast/(G)lobal/(Q)uit?".

     CygnusEd Professional is waiting for you to type one of these letters
to indicate:

          (Y)es   Replace this occurrence and search for the next.
           (N)o   Leave this occurrence alone and search for the next.
         (L)ast   Replace this occurrence and resume normal editing.
       (G)lobal   Replace this occurrence and all following occurrences.
         (Q)uit   Leave this occurrence alone and resume normal editing.

     When you select (G)lobal replacement, the replacements will happen
repetitively as fast as possible (displayed as they occur).  You can stop
the replacement at any time by pressing any key as CygnusEd Professional is
cycling through the replacements.

     The other responses to the replace query perform their intuitive
function.

     Selecting the REPEAT REPLACE command will not cause the search/replace
requester to be redisplayed.  Rather, CygnusEd Professional assumes the
same parameters as the replace operation and will continue from the current
cursor location.

     If the cursor is on the second string gadget (the one that contains
the replacement text) and you want to go back and change the search text,
you can either click on the first gadget with the mouse or you can type
SHIFT-RETURN.


4.2  Cutting And Pasting

     With CygnusEd Professional you can cut and paste arbitrarily sized
chunks (called "blocks") of text in your files.  You can move blocks of text
from place to place and from file (or view) to file (or view) very easily.
You can also save pieces of your work as seperate files on disk or transform
a block of text by using CygnusEd Professional's block commands.

     To do this, you must first indicate to CygnusEd Professional the
region of your file you wish to work with.  CygnusEd Professional has two
ways of designating a block:  You can define it as a linear block, where
all the text between one position in the file and another defines the
block; or you can define it as a columnar (or vertical) block, where a
rectangular section of the file can be used.

                                  Page 24

----------------------------------------------------------------------------



     You use the MARK BLOCK command for the first variant and the MARK
COLUMNAR BLOCK for the second.  These commands define the starting point of
the block.  You can then move the cursor to the opposite end or corner of
the area you wish to select.  Notice that as you do this, the text which
will be included in the block is highlighted.

     When the cursor is at the other end of the block, i.e.; when all of
the text you wish to operate on is highlighted, you can use block commands.

     If you select CUT BLOCK, then the text in the area you selected will
be removed from the file.  The text that was removed will be stored in the
"block paste buffer", however, and you can use the INSERT BLOCK command
(described below) to re-insert (or "paste") it at the same location or
elsewhere.

     If you select COPY BLOCK, then the text selected will be stored in the
block paste buffer as well, but the file itself will be left undisturbed.
This is useful for selecting an area of text in one part of your document
that you want to copy to a new location.  You would highlight the area to
be copied to and select INSERT BLOCK.

     As you have seen, INSERT BLOCK will insert, or "paste" the contents of
the "block paste buffer" to the current cursor location.  The block paste
buffer always contains the area selected by the last CUT BLOCK or COPY
BLOCK command.

     If you select SAVE BLOCK, the block paste buffer can be stored to a
disk file.  The standard CygnusEd Professional file requester will ask you
to make a file selection.

     There is only one "block paste buffer" in CygnusEd Professional.  All
views and files share this one buffer.  This means that you can easily cut
a block out of one file and insert the block into another file.


4.3  Using Multiple Views And Files

4.3.1  Definitions

     CygnusEd Professional has the ability to have as many as ten "views" on
the display at one time.  These views can be of the same file (co-operating
views) or of different files (separate views), or a combination of both.

                                  Page 25

----------------------------------------------------------------------------



     A view is a portion of a file which is on screen at the moment.  Each
view has its own title bar, display area, and optional scroll bar to allow
it to behave independently from the other views.

     What this means from a user's standpoint is that you can edit several
areas of the same file at the same time, or compare several pieces of text
in several different files, or any possible mix.  This is a very useful for
programmers and other users who need to view and edit several files at
once, cut and paste between files or refer to different parts of the same
file easily.  It takes a while to get used to using it and to realize the
potential, but once you start using multiple views, you will never want to
go back to only having one at a time.


4.3.2  Using Multiple Views

     Co-operating views are two or more views which display the same file,
although they may be displaying different areas of that file.

     When you use the SPLIT VIEW command (AMIGA-d from the SPECIAL/VIEW
OPERATIONS menu), you create a co-operating view of the current file.  Both
views will be showing the same area of the file to start with.  At this
point if you type something into one of the views, what you are typing will
show up concurrently in both views.

     Only one view is active at a time - this view is the only one with a
cursor displayed in it so that you know which view you are typing in.  To
change active views, use the command NEXT VIEW or PREV VIEW (AMIGA-',' and
AMIGA-'.' respectively) or simply click the mouse pointer in the text of the
view you want to activate.

     Note that when you split a view, another title bar appears which shows
location in the file, etc.  This title bar can be moved up and down by
grabbing it with the mouse (or by using the SHRINK/GROW VIEW commands in
the VIEW OPERATIONS submenu in the SPECIAL menu).  Moving the title bar of
a view causes the bordering views to grow and shrink together in unison.  A
change done in one view will automatically happen in any other cooperating
views at the same time (this is why they are called "cooperating" views).
Similarly, if you save the file from one view, all changes made in other
cooperating views of the same file are also stored, since there is actually
only one copy of the file in memory.

                                  Page 26

----------------------------------------------------------------------------



     Splitting a view with "Split View" or AMIGA-d is different than
performing Open New twice on the same file.  The Split View will produce
two cooperating views.  Performing Open New twice on the same file will
actually open the file twice.  The two resulting views will NOT be
cooperative.  Cooperating and non-cooperating views can always be
differentiated by their title bars.  Cooperating views will list a view
number associated with each view.  Non-cooperating views will not.

     Besides using the mouse to size the views by sliding their title bars,
there are also some menu commands which will size the views for you.  When
you first split a view, the twin view will take up half the height of the
original.  If you want to expand the current view by a single line, select
the GROW VIEW command.  Likewise, the SHRINK VIEW command will decrease the
current view size by one line.  Both the SHRINK VIEW and GROW VIEW commands
work by moving the title bar of the active view up or down.  To move the
title bar of the view below (by menu selection rather than by the mouse),
you have to first activate that view.

     As an example of extending the function of CygnusEd Professional using
its macro facility, if you wanted to create functions for shrinking and
growing the current view by moving the title bar below, you can create a
macro that records a NEXT VIEW command, then a SHRINK or GROW VIEW command
and then a PREV VIEW command.

     You can also select EXPAND VIEW.  This command will explode the
current view to maximum possible size.  All other views above or below the
current view will be reduced to a single text line (plus the title bar)
each.

     A related command, AUTO-EXPAND VIEWS (AMIGA-[) is an environment
setting found in the ENVIRONMENT - GLOBAL SETTINGS menu.  When this option
is enabled, CygnusEd Professional will ensure that the current view is
always the maximum size.  This has the same effect as hitting EXPAND VIEW
every time you change views.

     To quit out of a view, select QUIT (AMIGA-q).  This command will
remove the current view and return you to the view above.  If you select
QUIT from the last view of a file and you have made changes to that file,
CygnusEd Professional will prompt you to save the file before exiting.
Also, if you quit from the last view remaining on screen, CygnusEd
Professional itself will be exited (but subject to hot-start if that is
enabled).


4.3.3  Using Multiple Files

     As mentioned earlier, you can edit several files at once with CygnusEd
Professional.  This can be done by specifying multiple files when you start
up CygnusEd Professional, or by selecting OPEN NEW (AMIGA-?) which will
split the current view in half providing a new empty view which can be
bound to a file with a subsequent OPEN.  The new file will be loaded in,
without disturbing the original view of the first file.

                                  Page 27

----------------------------------------------------------------------------



     You now have two files on the display.  You can then split these views
further if you wish.  You can size or move the views the same way as you
would co-operating views (see preceding chapter for information on using
multiple views).

     You can bounce back and forth between the different files (and views)
as often as you wish.  You can create co-operating views for either or both
files, or you can continue to load additional files into CygnusEd
Professional.

     This makes it easy to do cross-comparison of different files, since
you can see both files at the same time.  You can even use the block
operations to move information from one file to another via the block paste
buffer (see CUTTING And PASTING earlier in this manual).

     If you want CygnusEd Professional to appear with several files in it
when you first start up, you can specify all of the file names you want
loaded after the program name on the command line.  If CygnusEd
Professional is already loaded but dormant, you can use the CygnusEd
Activator, "ED", to cause CygnusEd Professional to load several files at
once as well (see the section on the CygnusEd Activator ED).  Example:

     CED file1 file2 file3

     If you are running CygnusEd Professional from the WorkBench you can
use EXTENDED SELECT to select multiple files and then double click on the
last one or on CygnusEd Professional.  Extended selection is a feature of
the WorkBench which allows you to have more than one icon highlighted at
once.  Click on the first icon, then hold down the shift key while clicking
on the icons of the other files to be loaded.  Then, while still holding
down the shift key, double click on either CygnusEd Professional or an icon
whose default tool is CygnusEd Professional.  CygnusEd Professional will
appear and will load in all of the selected files.


4.4  Printing Your File

     You will probably want to print out your file to a printer at some
time.  As CygnusEd Professional does not insert special formatting control
codes, you can use the CLI "Type" or "Copy" commands to send a file to the
printer (often the PRT: device).

     However, it is often more convenient to use the CygnusEd Professional
print function.  An advantage of using the CygnusEd Professional print
function is that it multitasks (you can resume using the editor as soon as
you have started a print job, without waiting for the print job to end).
Another is that you can get the CygnusEd Professional print function to
replace all tabs with the appropriate number of spaces as it prints (very
useful if you are using a non-standard tab size which your printer won't
understand).

                                  Page 28

----------------------------------------------------------------------------



     To print the entire active file, use the PRINT FILE option in the
PROJECT menu.  If you want to print a portion of your file, you can move it
to the block paste buffer using the CUT BLOCK or COPY BLOCK functions
described in the CUTTING And PASTING section of this manual.  Then use the
PRINT BLOCK function to print the block.

     When you select a print function, CygnusEd Professional will ask you
what file or device you wish to print it to.  Normally, you will print to
the device PRT:, which under AmigaDOS is the printer you have specified in
your Preferences.  This is the default.

     You can also send the printout to a file on the disk, or to a
different device, such as the serial port (SER:).  The CygnusEd
Professional file requester will ask for the output name.  If you are
specifying a device, you should enter the device name in the file name
line, rather than the directory name line.

     When you specify where the output will go, a new print requester will
appear.  The print options requester will give you the option of converting
existing tabs to spaces (default) or existing spaces to tabs.

     Converting tabs to spaces has the effect of ensuring that no matter
what your tab settings are in CygnusEd Professional as compared to the
printer, your text will look the same on the printer as on the screen.
CygnusEd Professional replaces all tabs in your file with the correct
number of spaces to the next tab stop as it prints.

     Converting spaces to tabs is useful for changing the tab size of a
document.  For example, if you have a document that had irregular tab stops
and you want to convert it to tab size 8 without changing the look of the
existing text you would:  1.  Print the file using tabs to spaces,
outputting to a disk file, 2.  Load the disk file you just created, 3.
Change the tab settings to regular intervals of eight, and 4.  Print the
file using spaces to tabs.

     The print options requester also has a gadget asking for the number of
characters to indent the file.  The number entered here is effectively the
"left margin" of the printout.

                                  Page 29

----------------------------------------------------------------------------



     Before starting the print job CygnusEd Professional makes a copy of
the file or block to be printed.  Therefore, as soon as the print job has
started you can continue using the editor including the "block paste
buffer" or quit out of the file being printed without interfering with the
printout.

                                  Page 30

----------------------------------------------------------------------------
