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

Jason Harris jason at jasonfharris.com
Mon May 2 14:39:47 CDT 2011


On May 2, 2011, at 2:49 PM, Sune Foldager wrote:

> 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 ;)

That was really embarrassingly stupid of me... That is what comes from redoing a patch 2 weeks after I had previously done it.

Right I just emailed the V3 version as you say...

Thanks and sorry,
 Jas


More information about the Mercurial-devel mailing list