comparison mercurial/windows.py @ 11010:18e81d42ee5c stable

util: fix default termwidth() under Windows sys.stdout.write('-'*80 + '\n') or sys.stdout.write('-'*80 + '\r') do not work on Windows as they do on unix. On a 80 columns Windows console, the extra CR or LF are interpreted as if belonging to the next line, so the first command displays 2 lines (only one on unix) and the second one leave the line visible and move back to the following line. To avoid this, we sacrifice one column under Windows.
author Patrick Mezard <pmezard@gmail.com>
date Mon, 26 Apr 2010 22:30:40 +0200
parents 4612cded5176
children 99eee847beaa
comparison
equal deleted inserted replaced
11007:a0102da324ab 11010:18e81d42ee5c
354 return pid 354 return pid
355 355
356 def gethgcmd(): 356 def gethgcmd():
357 return [sys.executable] + sys.argv[:1] 357 return [sys.executable] + sys.argv[:1]
358 358
359 def termwidth_():
360 # cmd.exe does not handle CR like a unix console, the CR is
361 # counted in the line length. On 80 columns consoles, if 80
362 # characters are written, the following CR won't apply on the
363 # current line but on the new one. Keep room for it.
364 return 79
365
359 try: 366 try:
360 # override functions with win32 versions if possible 367 # override functions with win32 versions if possible
361 from win32 import * 368 from win32 import *
362 except ImportError: 369 except ImportError:
363 pass 370 pass