Ported textcursor from Purple Shoes. Try out the following:

Shoes.app do
  msg = para 'hello ' * 20
  msg.cursor = -1
  keypress do |k|
    n = case k
      when 'ARROW_LEFT'; -1
      when 'ARROW_RIGHT'; 1
      else
        next
    end
    n += msg.cursor
    len = msg.text.length
    n = len unless n > -1
    msg.cursor = n % (len+1)
    gui.flush
  end
end