/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Martin Pool
  • Date: 2006-05-09 07:16:38 UTC
  • mto: This revision was merged to the branch mainline in revision 1707.
  • Revision ID: mbp@sourcefrog.net-20060509071638-c6cb81c352612d82
(win32) Detect terminal width using GetConsoleScreenBufferInfo (Alexander)

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
                           IllegalPath,
40
40
                           )
41
41
from bzrlib.trace import mutter
 
42
import bzrlib.win32console
42
43
 
43
44
 
44
45
def make_readonly(filename):
667
668
 
668
669
def terminal_width():
669
670
    """Return estimated terminal width."""
670
 
 
671
 
    # TODO: Do something smart on Windows?
672
 
 
673
 
    # TODO: Is there anything that gets a better update when the window
674
 
    # is resized while the program is running? We could use the Python termcap
675
 
    # library.
676
 
 
 
671
    if sys.platform == 'win32':
 
672
        import bzrlib.win32console
 
673
        return bzrlib.win32console.get_console_size()[0]
677
674
    width = 0
678
 
    
679
675
    try:
680
676
        import struct, fcntl, termios
681
677
        s = struct.pack('HHHH', 0, 0, 0, 0)