[PATCH] Detect console width on Windows

Dan Villiom Podlaski Christiansen danchr at gmail.com
Mon Apr 26 06:39:06 CDT 2010


On 25 Apr 2010, at 19:09, Patrick Mézard wrote:

> Two remarks here:
> - We need the COLUMNS logic to override termwidth() from command line (tests use it)
> - I am tempted to catch exceptions from GetStdHandle() but I have no real use case to backup my paranoia, so this can probably stay for now.
> 
> If you agree with all these remarks, just tell me I will update the patch and push it after more tests.

Wouldn't it make more sense to have HGPLAIN affect the terminal width too? The COLUMNS fallback has the annoying effect that changing the terminal width during a long session doesn't affect Mercurial.

Also, the »Progress extension, windows and carriage return« thread suggests that this problem is a general problem on Windows. It seems to me that it would be much better to subtract/not add 1 to the terminal width on Windows. After all, util.termwidth() is much more useful if it consistently means something like the amount of characters that can safely be written to a single terminal line.

--

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/5904c8db/attachment.bin>


More information about the Mercurial-devel mailing list