Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: wrap - wrap-text

From: arolls:bigpond:au at: 31-Jul-2001 1:19

Replace this wrap-text function with yours found at: http://www.geocities.com/~jimclatfelter/wordwrap.txt I have used two newlines to indicate a new paragraph. So, you need to add a newline at the beginning of your supplied text. wrap-text: func [ para /margin size /local count ][ count: 1 if not margin [size: 50] ; default size ; (two newlines) -> (two newlines and some spaces) replace/all para "^/^/" "^/^/ " ; five spaces forall para [ if (first para) = newline [count: 0] if all [ count >= size find/reverse para " " ][ para: find/reverse para " " change para newline count: 0 ] count: count + 1 ] head para ]