On 4/15/06, Sy Ali <sy1234 / gmail.com> wrote:
> This definitely points me in a direction I can work with.

I'm definitely drifting off topls, but I suppose this is a feature I'd
love to see in HighLine.

I think I understood where you were going.  I cut it apart and made a
simplified version which demonstrates my goal.  I haven't achieved
what I wanted yet.. because I don't know how to take a string and
split it into an array at a certain length number.

I'm thinking in very small units right now.  In the end this ought to
deal with any one of the items in the original array being long enough
to require it wrap on the next line.


require 'desc/sy_helper.rb'

# Can have an arbitrary number and length of items on the left.
# These are a[0..-2]
a = []
a << "foo"
a << "bar"
a << "baz"
a << " "

# This is a.last
a << "Some more text Some more text Some more text Some more text Some
more text Some more text"

# Create the first line of content.
# Turn the array into a string separated by spaces
left = array_to_string(a[0..-2], " ")

# TODO: This should be more universal, and wrap on a certain character
number of the length of the third column.  Preferably to the nearest
whitespace character so that words aren't chopped off.
puts       left        + a.last[ 0..30]
puts " " * left.length + a.last[31..61]
puts " " * left.length + a.last[62..-1]

# =>
# foo bar baz  Some more text Some more text S
#              ome more text Some more text So
#              me more text Some more text