home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / MUI / MCC_TextEditor / Demos / Rexx / Reformat.Rexx < prev   
Encoding:
OS/2 REXX Batch file  |  1997-10-03  |  594 b   |  46 lines

  1. /*  Reformat a paragraph */
  2.  
  3. Options Results
  4.  
  5. Position SOL
  6. SetBookmark 3
  7. Line 1
  8. GetLine
  9. LineContents = RESULT
  10. MoreLines = 1
  11.  
  12. Do While ((LineContents ~= '0a'x) & (Left(LineContents,1) ~= ' ') & (MoreLines ~= 0))
  13.  
  14.     Position SOL
  15.     Backspace
  16.     Text ' '
  17.  
  18.     GetCursor Line
  19.     CurrentLine = RESULT
  20.     Line 1
  21.     GetCursor Line
  22.     if(RESULT = CurrentLine) Then MoreLines = 0
  23.  
  24.     GetLine
  25.     LineContents = RESULT
  26.  
  27. End
  28.  
  29. GotoBookmark 3
  30. GotoColumn 80
  31. GetCursor Column
  32. ColumnNr = RESULT
  33.  
  34. Do While (ColumnNr = 80)
  35.  
  36.     Previous Word
  37.     Backspace
  38.     Text '0a'x
  39.     GotoColumn 80
  40.     GetCursor Column
  41.     ColumnNr = RESULT
  42.  
  43. End
  44.  
  45. Cursor Right
  46.