-={ RETRIEVING DELETED TEXT IN WORDSTAR }=-

                      by Laurie J. Braaten

Anyone  who  has worked with WordStar for any length of time  has 
probably  had the misfortune of deleting the wrong line or  block 
of text.  By some fancy manuevering, you might be able to recover 
the  text  from your backup file.   If you  have  a  photographic 
memory, you may be able to retype it in no time.  But if these do 
not  work,  you  should  be set for a frustating time  trying  to 
reconstruct  your  lost data.   Now you can  avoid  this  problem 
altogether by adding a "Yankback" feature to WordStar.   This can 
be  done quite simply with a series of command strings ("macros") 
which  I call "WS Yankback," set up in a key definition  program.  
(The  more  popular commercial key definition  programs  such  as 
Smartkey,  Xtrakey  and  the Backgrounder have been  reviewed  by 
Glenn  Grant in the December 1985 issue of  PROFILES.   KSSTROKES 
4.0,  QWIKEY21,  &  GKEY2 are  public domain programs which  give 
good, but more limited results.)

                    HOW TO SET UP WS YANKBACK

FIRST,  set  up four macros which will now be used to delete text 
in place of their WordStar counterparts.  The first will delete a 
line.  The second will delete a block of text.  The third deletes 
text  left of the cursor;  the fourth deletes text right  of  the 
cursor.   All macros should be entered as continuous text without 
spaces.   The  ^ symbol is the control key,  held down while  you 
type the key which follows it; <cr> is a carriage return (or ^M).

MACRO #1:  ^QS^KB^X^S^KK^KWA:YANKEE<cr>Y^KY
MACRO #2:  ^KWA:YANKEE<cr>Y^KY
MACRO #3:  ^KK^QS^KB^KWA:YANKEE<cr>Y^KY 
MACRO #4:  ^KB^X^QS^S^KK^KWA:YANKEE<cr>Y^KY 

SECOND, enter the yankback command: 

MACRO #5:  ^KRA:YANKEE<cr>

THIRD,  on your WordStar disk,  open a file named "YANKEE."  This 
is  where  your deleted text will be stored.   This file will  be 
overwritten  every time you delete text,  so it does  not  matter 
what you type in it--a  single character will do.   But make sure 
that  you  have adequate disk space for any text you may want  to 
delete (2K-6K should be plenty for most operations). 

Now, when you want to delete a line, use macro #1.  It works just 
like ^Y: place the cursor anywhere on a line and use it to delete 
the  entire  line.   If you want to yank back the  deleted  line, 
execute macro #5.  When deleting a block of text, use macro #2 in 
the  same way you would use ^KY.   Mark the beginning and end  of 
the block with ^KB and ^KK respectively,  and execute macro #2 to 
delete  the marked block.   If the block needs to  be  recovered, 
macro  #5 will yank it back.   Numbers 3 and 4 work like  ^Q<del> 
and  ^QY--only  now  the deleted text can be retrieved  with  the 
yankback command.   (Macro #1 leaves a blank line where the  text 
has  been  removed.   If this is undesirable simple omit  the  ^S 
after the ^X.)

Before  using  WS Yankback,  be sure to test it  thoroughly.   If 
there  are  errors in the way the macros were entered  you  could 
lose  more text than you planned to delete,  and not be  able  to 
recover  it.   Use a practice file and check all of the commands.  
If  they do not work,  carefully recheck the macros to make  sure 
they have been entered correctly.

N.B.  The  yankback  command WILL NOT WORK if you  use  ^Y,  ^KY, 
^Q<del> or ^QY to delete text.   The four macros given above must 
be  used instead of these WordStar commands for the  yankback  to 
recover the deleted text.
                      HOW WS YANKBACK WORKS

WS  Yankback  simply writes the deleted text onto the file  named 
YANKEE,  and  then deletes it from the working  text.   When  the 
yankback  is  used,  the text is read back into your file at  the 
present position of the cursor.   This operation takes some time, 
which  is  its major drawback.   When deleting  blocks  of  text, 
however,  it  may  be worth the extra time to have the  assurance 
that the data can be recovered.   Since WS Yankback always writes 
the deleted line on the text YANKEE,  the recovery operation will 
ONLY  WORK  FOR  THE  LAST  DELETION--you  cannot  retrieve   any 
materials deleted before the last text was deleted.  

                         WHAT ABOUT ^Y ?

If you decide to use the first macro in place of ^Y, you may find 
that  you still have problems with ^Y.   You may accidentally hit 
^Y when you want a ^T,  or you may attempt to type an upper  case 
"Y"  (which,  believe  or  not,  I use quite often) and  hit  the 
control key instead of the shift key.  I have solved this problem 
by following Ted Silveira's advice in PROFILES, July/August 1985, 
p.  44.   Using DDT (etc.) or Winstall's custom patch "+"  (which 
does not appear on the options menu), you may change address 054D 
(0535  in WordStar 3.0) to read "19 19" (hex) instead of "19 00."  
The  result  is that it now takes TWO ^Ys (or ^YY)  to  delete  a 
line,  minimizing the possibilities for an accident.   Now when a 
^Y  is  hit  by mistake,  the space bar will get you out  of  the 
partially executed command.   If you find yourself rapidly typing 
two  or  more ^Ts without looking at either the keyboard  or  the 
results onscreen,  you may want to try Melvyn Halbert's solution, 
found  on  the Tampa Bay KUG board (813-791-1454).   He  suggests 
changing the "19" at the appropriate address to "1C" (hex), which 
will reassign the delete line function to ^\ instead of ^Y. 
nging the "19" at the