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: 1-Aug-2001 3:03

> Thanks for the wrap function. I took out the 5 spaces because I > didn't want to > indent the paragraph. I wanted to indent all the lines by 5 > spaces. I put the > new script at http://www.geocities.com/~jimclatfelter/wordwrap.txt > Any ideas on how to get a 5 space margin on every line? That way > I can print > exactly what is on the screen with a 5 space margin on the left > of the page.
Modifying my last example: 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 "^/^/" "^/^/ " count: 5 forall para [ if (first para) = newline [count: 0] if all [ count >= size find/reverse para " " ][ para: find/reverse para " " change para newline para: insert next para " " count: 5 ] count: count + 1 ] head para ]