home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / epmsmp.zip / REVERSE.E < prev    next >
Text File  |  1992-08-26  |  635b  |  21 lines

  1. ; Repeat the previous Locate, but in the reverse direction.
  2. ; E.g., if you search for a string that you know exists, but
  3. ; it's not found before the end of the file, press Ctrl+minus
  4. ; to repeat the search for the same string looking from the
  5. ; cursor position to the beginning of the file.
  6.  
  7. ; by Larry Margolis
  8.  
  9. def c_minus =
  10.    getsearch oldsearch
  11.    parse value oldsearch with . c_or_l search
  12.    delim = leftstr(search,1)
  13.    newsearch = oldsearch
  14.    if lastpos(delim,search)=1 then
  15.       newsearch=newsearch || delim
  16.    endif
  17.    newsearch=newsearch'-'
  18.    setsearch newsearch
  19.    repeatfind
  20.    setsearch oldsearch
  21.