[PATCH] Detect console width on Windows

Dan Villiom Podlaski Christiansen danchr at gmail.com
Mon Apr 26 08:40:08 CDT 2010


On 26 Apr 2010, at 15:36, Patrick Mézard wrote:

> Le 26/04/10 15:20, Dan Villiom Podlaski Christiansen a écrit :
>> 
>> On 26 Apr 2010, at 15:16, Patrick Mézard wrote:
>> 
>>>> The COLUMNS fallback has the annoying effect that changing the terminal width during a long session doesn't affect Mercurial.
>>> 
>>> I don't follow you here.
>> 
>> What I mean is that if I resize the window during a long Mercurial session — such as an hgsubversion pull — it has no effect. Normally, COLUMNS is set by the shell when Mercurial is invoked, and never changed during its execution. If I make my terminal window smaller, any new messages will be wrapped…
> 
> Sure, but I don't really see how it relates to the discussion: COLUMNS already overrides posix termwidth() so windows must honor it the same way. AFAIK, COLUMNS is not a default environment variable in cmd.exe, that's something you set explicitely. I see COLUMNS as a convenient option for tests or scripting, like HGPLAIN, but perhaps that's different on unix? (http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap08.html seems to agree with me).

I stand corrected… I *thought* it was set by default by the shells, but I just checked, and at least my shell (Zsh) doesn't set it. Sorry 'bout that! :)

--

Dan Villiom Podlaski Christiansen
danchr at gmail.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1943 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100426/7bcb2c2d/attachment.bin>


More information about the Mercurial-devel mailing list