[PATCH V2] util.termwidth: never return 0 for terminal width

Sune Foldager cryo at cyanite.org
Mon May 2 07:49:41 CDT 2011


On 02-05-2011 14:35, Martin Geisler wrote:
> Jason Harris<jason.f.harris at gmail.com>  writes:
>
>> diff --git a/mercurial/posix.py b/mercurial/posix.py
>> --- a/mercurial/posix.py
>> +++ b/mercurial/posix.py
>> @@ -316,7 +316,9 @@
>>                   if not os.isatty(fd):
>>                       continue
>>                   arri = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 8)
>> -                return array.array('h', arri)[1]
>> +                width = array.array('h', arri)[1]
>> +                if width<  0:
>> +                    return width
>
> If you want to never return 0, then this should be 'if width>  0',
> right?

I was thinking the same, but thought that it was some advanced terminal 
stuff I didn't understand ;)

Sune


More information about the Mercurial-devel mailing list