Works here:

By default though it is not exported. You have to do

export COLUMNS

in the shell first. Then ruby sees it and it works.

We don't need dynamic COLUMNS capability in capistrano because it is a
one shot command - not constantly running.

Beyond that you have to do some nasty messing around in
terminfo|termcap.

ENV["COLUMNS"] is an engineering compromise, and if it is 'nil' you
fall back to 80.



On Jan 12, 5:29 pm, Jamis Buck <[EMAIL PROTECTED]> wrote:
> Actually, looks like Ruby can't see the ENV["COLUMNS"] value (see  
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/211453).
> For now, I'll just drop that part of the patch and hard-code 80,
> until someone can come up with a platform-independent way of querying
> the terminal size.
>
> - Jamis
>
> On Jan 12, 2007, at 10:08 AM, NeilW wrote:
>
>
>
> > First patch the patch.
>
> > Should be:
>
> > wrap_length = (ENV['COLUMNS'] || 80).to_i - info[:longest] - 1
>
> > The existing code fails for me on the standard 'spinner' and
> > 'update_code' tasks both of which wrap the odd line by one character.
> > I'm using standard Ubuntu Gnome terminals.
>
> > Worth checking you have a genuine 80 column terminal first by
> > generating a wrap, e.g.
>
> > ruby -e '81.times {print "x"}'
>
> > Rgs
>
> > NeilW
>
> > On Jan 12, 4:29 pm, Jamis Buck <[EMAIL PROTECTED]> wrote:
> >> Thanks for the patch, Neil! However, I'm curious... I've never
> >> noticed any problems. Can you give me an example where the existing
> >> code breaks down?
>
> >> Regardless, I'll be applying your fix.
>
> >> - Jamis
>
> >> On Jan 12, 2007, at 9:03 AM, NeilW wrote:
>
> >>> That 'off by one' error in 'show tasks' finally annoyed me enough
> >>> this
> >>> afternoon to knock together a fix.
>
> >>> The problem is caused because there is a space separator in the
> >>> 'puts'
> >>> picture string which isn't taken into account by the line split
> >>> algorithm.
>
> >>> Additionally I included a look in the environment for the value of
> >>> 'COLUMNS', which on many Linux distributions is set to the width of
> >>> the
> >>> terminal. (Make sure you export it if you want it to work!)
>
> >>> Line 29 in 'standard.rb'
>
> >>> Change
>
> >>> wrap_length = 80 - info[:longest]
>
> >>> to
>
> >>> wrap_length = (ENV['COLUMNS'].to_i || 80) - info[:longest] - 1
>
> >>> Finally my task descriptions format correctly; harmony is
> >>> restored :-)
> 
> >>> NeilW


--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to