home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 626a.lha / Textra_v1.12 / Scripts / C_Scripts / UnBox.textra < prev   
Text File  |  1992-03-16  |  2KB  |  67 lines

  1.     /*******************************************************************
  2.      *   TEXTRA AREXX script -- Mike Haas, 1991, All Rights Reserved.  *
  3.      * Freely distributable ONLY as a component of the TEXTRA package. *
  4.      * This banner may not be removed or altered (improvements to the  *
  5.      *    actual program welcome).  Please document and send to me.    *
  6.      *        !!! PLACE THIS FILE IN YOUR REXX: DIRECTORY !!!          *
  7.      *******************************************************************/
  8.  
  9. /*
  10. ** routine to delete a comment box from around the selected text
  11. **   adapted from Mike Haas's 'slide' routine
  12. */
  13.  
  14. OPTIONS results
  15.  
  16. 'get' "select position"   /* get the select boundary, if any */
  17.  
  18. if (result == "NO SELECT") then   /* is nothing selected? */
  19.     exit   /* Then just go back */
  20.  
  21. parse var result   startx ' ' starty ' ' endx ' ' endy
  22. LinesSelected = (endy - starty)
  23.     
  24.     /* if only the 'eol' of the previous line is selected
  25.     (nothing on this line is actually included, i.e. x==0),
  26.     then don't include it.
  27.     */
  28. if (endx > 0) then
  29.     LinesSelected = LinesSelected + 1
  30. else
  31.     endy = endy - 1
  32.     
  33. /*
  34. ** someday, this'll be a real careful, checking routine.  But for the nonce,
  35. **  we'll just assume that the line at the beginning of the selection region
  36. **  is the "/*****..." line, while the line at the end is the "...*****/" 
  37. **  line
  38. */
  39.  
  40. 'unselect'
  41. 'gotoxy' 0 endy
  42. 'selectto' 0 endy+1
  43. 'del'
  44. 'gotoxy' 0 starty
  45. 'selectto' 0 starty+1
  46. 'del'
  47.  
  48. do LinesSelected - 2
  49.    /* At this point we are in column zero of a line to have its '*'s
  50.    ** removed.
  51.    */
  52.     'del'; 'del'   /* The '* ' at the beginning */
  53.     'down' 1
  54.     'left' 1
  55.     'backspace'    /* The '*' at the end of the line */
  56.     do forever
  57.         'left' 1
  58.         'get cursor char'
  59.         if (result ~= ' ') then leave
  60.         'del'
  61.     end
  62.     'right' 2
  63. end
  64.  
  65. exit
  66.  
  67.