home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / uedit-stuff_429.lzh / Uedit-Stuff / Delete.doc < prev    next >
Text File  |  1991-01-10  |  12KB  |  201 lines

  1.  
  2.                PAUL KIENITZ'S UEDIT SCRATCH DELETE COMMANDS
  3.  
  4.     Have you ever wished that you could paste back (undo) the delete before
  5. last?  Or the one before that?  Have you ever wished the scratch delete
  6. commands had more sense about when to merge consecutive deletes together, and
  7. when not to?  Have you ever wished it was easier to add new delete commands
  8. that would know how to merge properly?  The answer is here -- a complete
  9. replacement set of scratch delete commands that remember the last eight
  10. chunks of deleted text.  I find them to be the most useful commands I have.
  11.  
  12.     These commands replace the following commands from the standard config: 
  13. everything on kp0, kp7, and kp9; ctl-d, ctl-del, ctl-bs, and virtual-x; and
  14. lAmiga-1.  It also adds new commands, mostly lAmiga-kpX combinations.  The
  15. new commands have these properties:
  16.  
  17.     The last eight chunks of text deleted are stored in a ring (a circular
  18. stack).  The most recently deleted chunk is what kp0 pastes back.  The ring
  19. can be rotated with two new commands: lAmiga-kp4 and lAmiga-kp6.  If you view
  20. the newest delete buffer in a split window with lAmiga-1, using the rotate
  21. commands will let you see all eight chunks.
  22.  
  23.     Consecutive deletes merge together in the right order when either end of
  24. the piece being cut adjoins the location of the previous cut.  But only if
  25. the most recent cut was in this same buffer and there has been no paste since
  26. the last cut.  The location of the cursor doesn't matter.  For instance, you
  27. can delete the next line with ctl-bs, then delete this line with ctl-d, then
  28. the previous line with ctl-del, and kp0 will restore all three lines together
  29. in the correct order.  If you want to prevent two deletes from merging, press
  30. ctl-kp0 before making the second delete and they'll be kept separate.  If
  31. they don't join when you thought they would, no problem.  Just rotate the
  32. ring to get both pieces back.
  33.  
  34.     Every delete command is very simple to write, since all the hard work is
  35. done by a runkey.  You just do this:  first, equateLoc(curFile, mouseLoc,
  36. locB).  MouseLoc temporarily marks the spot where the previous delete in this
  37. buffer happened.  Then, mark the region to be deleted with locA at the start
  38. and locB at the end.  Then runKey(virtual-kp7).  That's all.
  39.  
  40.     The following are new commands:
  41.  
  42. ctl-kp0:        Prevents the next delete from merging with the previous one,
  43.                 even if at an adjoining location.
  44.  
  45. lAmiga-kp4:     Makes the newest chunk of deleted text on the ring become the
  46.                 "oldest"; the second-newest is now what kp0 pastes back.
  47.                 Warning:  if you delete again, the most recent delete before
  48.                 that, being "oldest" now, is discarded.
  49.  
  50. lAmiga-kp6:     Makes the oldest chunk "newest".
  51.  
  52. lAmiga-kp1:     A shortcut for lAmiga-kp0 lAmiga-kp4 normal-kp0;  it replaces
  53.                 the last chunk you pasted back with the next older chunk. 
  54.                 This is often the most convenient way to paste back an older
  55.                 chunk; first go kp0 and then repeat lAmiga-kp1 until you see
  56.                 the chunk you want.  (The next kp0 will paste that chunk you
  57.                 ended up with, not the one it did originally.)  The cursor
  58.                 must be at the end of the last paste, just as for lAmiga-kp0.
  59.  
  60. lAmiga-kp0:     Undoes the last paste; re-deletes the last chunk of text that
  61.                 was inserted with kp0.  This only works if there has been no
  62.                 further cut since the last paste, and the cursor is at the
  63.                 end of the chunk just inserted.  It might not work properly
  64.                 if you run other commands after the paste which use locA.  If
  65.                 you move the cursor, you can get back with:
  66.  
  67. lAmiga-kp5:     Moves the cursor to the location of the last delete, or the
  68.                 end of the last paste (locB).
  69.  
  70.     These next few are strictly extras:
  71.  
  72. lAmiga-kp8:     Moves the cursor to the start of the last paste (locA), if
  73.                 there has been one since the last cut.  If you run other
  74.                 commands, this might end up anywhere.
  75.  
  76. lAmiga-kp7:     Prompts for you to type a character, and then deletes from
  77.                 the cursor back to most recent occurence of that character. 
  78.                 If the character is a letter, it ignores case if the
  79.                 searchCaps flag is false.  The character itself is not
  80.                 deleted, and the character immediately to the left of the
  81.                 cursor is not checked to see if it is the one specified.
  82.  
  83. lAmiga-kp9:     Like lAmiga-kp7, but deletes forward.  Does not look at the
  84.                 character under the cursor.
  85.  
  86. lAmiga-kp3:     Extends the last delete to the cursor in either direction. 
  87.                 That is, if you make any delete, you can merge another chunk
  88.                 onto it on either side by simply putting the cursor at the
  89.                 other end and pressing lAmiga-kp3.  Or, it deletes from the
  90.                 cursor to the end of the last paste, if that's what you did
  91.                 most recently.  This is handy for deleting odd shaped chunks.
  92.  
  93. shftAlt-kp7:    Deletes from the cursor back to the first printable character
  94.                 on the line, leaving the indentation intact.  This won't work
  95.                 without the ctl-[ command described in the Indent file.
  96.  
  97. shftCtl-kp7:    Delete from the cursor back to the beginning of the
  98.                 paragraph.  Actually, this version just deletes back to the
  99.                 nearest blank line (not counting blank lines at the cursor).
  100.  
  101. shftCtl-kp9:    Delete from the cursor up to the end of the paragraph. 
  102.                 Actually, up to the next blank line (not counting blank lines
  103.                 at the cursor).  Maybe someday I'll do a version that looks
  104.                 at the indentation of lines.
  105.  
  106. shftAltCtl-f7:  Sets the search string using the last cut text as the default.
  107.                 Like, you delete a few words, and then maybe paste them right
  108.                 back, and then you can search for other copies of that phrase
  109.                 with SAC-f7, possibly modifying them while in inputString.
  110.  
  111.     The lAmiga-1 command, which views the newest delete buffer in a split
  112. window, has been changed so that by default it leaves the window you were in
  113. the active one.  If you press lAmiga-1 again, that split becomes the active
  114. window.  If you don't want that feature (like because if you have two window
  115. splits of the same file it might end up in the wrong one, or because the main
  116. reason you want the split window is to modify the cut text) then there is a
  117. simpler alternate version of the command, commented out, right after the
  118. other one in the config file.  Editing in the delete buffer is risky, because
  119. thoughtlessly deleteing while in the delete buffer may cause the text you cut
  120. to vanish entirely, or it may end up just dumping you into the next buffer in
  121. the ring.  The deleting engine virtual-kp7 is set up so that if a lAmiga-1
  122. split window exists, it will be updated continually as you delete.  If you
  123. don't want that feature (which costs speed), remove the three lines in the
  124. definition of virtual-kp7 that are marked with ** in a comment.  To close the
  125. split, press lAmiga-kp1 again to activate the split before pressing lAmiga-0.
  126.  
  127.     Here is a quick summary of these commands, suitable for being put in your
  128. Help! file:
  129.  
  130. DELETE & UNDO:
  131. =============
  132. kp0:    Paste; undo latest scratch delete, inserting at cursor
  133. C-d:    Delete cursor line, storing it in Undo buffer
  134. C-bs:   Delete line below cursor line, save in undo buffer
  135. C-del:  Delete line above cursor line, save in undo buffer
  136. kp7:    Delete word left, storing it in Undo buffer
  137. kp9:    Delete word right, storing it in Undo buffer
  138. S-kp7:  Delete char to left of cursor, storing it in Undo buffer
  139. S-kp9:  Delete char under cursor, storing it in Undo buffer
  140. A-kp7:  Delete to start of line, storing it in Undo buffer
  141. A-kp9:  Delete to end of line, storing it in Undo buffer
  142. C-kp7:  Delete to top of window, storing it in Undo buffer
  143. C-kp9:  Delete to end of window, storing it in Undo buffer
  144. L-kp7:  Delete back to last occurence of given character, storing in Undo
  145. L-kp9:  Delete to next occurence of given character, storing it in Undo buffer
  146. SC-kp7: Delete back to last blank line, storing it in Undo buffer
  147. SC-kp9: Delete to next blank line, storing it in Undo buffer
  148. SA-kp7: Delete back to end of indentation (first printable char on this line)
  149. L-kp3:  Extend last delete to cursor (merge with previous delete)
  150. C-kp0:  Prevent next delete in same place from merging with previous
  151. L-kp0:  Un-undo (re-delete) last paste, if cursor is at same place
  152. L-kp1:  Replace last paste with older deleted text (which is now "newest")
  153. L-kp5:  Go to location of last scratch delete or paste (bottom end)
  154. L-kp8:  Go to top end of last paste, or maybe who knows where
  155. L-kp4:  Make newest scratch delete "oldest"
  156. L-kp6:  Make oldest scratch delete "newest"
  157. L-1:    Show newest delete in split window (use L-kp4 & L-kp6 to see all)
  158. SAC-f7: Set search string using text in Undo buffer
  159.  
  160.  
  161.     I know that's a lot of commands to incorporate into your stuff, but
  162. since these are some of the most basic and heavily used commands in routine
  163. editing, it makes sense to concentrate a lot of improvement here.
  164.  
  165.     The following commands in the standard config trash locA:
  166. shftAltCtl-buttonDown, ctl-tab, ctl-j, alt-1, alt-5, ctl-3, ctl-4, alt-s,
  167. lAmiga-r, lAmiga-d, and lAmiga-p, and the spelling commands rAmiga-4,
  168. rAmiga-5 and rAmiga-6.  My indent commands alt-[ and alt-] do too, and so
  169. does my replacement normal-tab when it runs alt-] (see Indent.doc).
  170.  
  171.     Technical notes:  The range of buffers used to store the cut chunks is 80
  172. through 87.  This can be changed quite easily, since only the three commands
  173. lAmiga-kp4, lAmiga-kp6, and virtual-kp7 have any knowledge of which buffers
  174. (or how many) are in use.  The lines to change are marked with the word
  175. "Bounds" in a comment.  The n-variables used are n27 and n28.  Changing these
  176. are less easy, because more commands mention them, such as all the kp0
  177. commands, lAmiga-kp8, and virtual-kp4, which is used to change the split
  178. window display to a different buffer when the "top" position moves.  Like the
  179. standard commands, these require that locB not be changed by other commands
  180. if you want merging to work right, but locA can be trashed.  As mentioned,
  181. these commands trash mouseLoc.  They won't require any initialization, if you
  182. trust the n-variables to all contain zero at startup.  If you want to
  183. explicitly initialize them, put -2 in n27 and 80 in n28, or zero in both. 
  184. Since the startup key doesn't seem to ever run equateNum as advertised, the
  185. only way to do this is to have it runKey something that puts a magic number
  186. in some n-variable to tell it that it's already been run if it gets run
  187. again.  If you're working with tight memory, storing eight pieces might be
  188. trouble; unfortunately there's no way with this version of Uedit for a CL
  189. function to tell when memory is low, and even more unfortunately, insertRgn
  190. with no memory can basically wedge the whole system and may cause a crash
  191. somewhere else; abort has been observed not to work at such times.
  192.  
  193.  
  194.                                 Hope all this is useful.
  195.                                 Feedback is appreciated.
  196.  
  197.                 email: none             Paul Kienitz
  198.                 bbses: 415-845-4812     6430 San Pablo ave.
  199.                        415-222-9416     Oakland, CA, 94608
  200.                                         USA
  201.