[PATCH] Detect console width on Windows

Patrick Mézard pmezard at gmail.com
Mon Apr 26 08:16:00 CDT 2010


Le 26/04/10 13:39, Dan Villiom Podlaski Christiansen a écrit :
> 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?

Possibly yes, that would be another patch.

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.

> 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.

Yes, that's another option.

--
Patrick Mézard


More information about the Mercurial-devel mailing list