~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/win32console.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-05-12 23:48:49 UTC
  • mfrom: (1704.2.13 bzr.mbp.integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060512234849-259ff209fff58489
(mbp) various fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   ctypes = None
14
14
 
15
15
 
 
16
WIN32_STDIN_HANDLE = -10
 
17
WIN32_STDOUT_HANDLE = -11
 
18
WIN32_STDERR_HANDLE = -12
 
19
 
 
20
 
16
21
def get_console_size(defaultx=80, defaulty=25):
17
22
   """ Return size of current console.
18
23
 
26
31
       # no ctypes is found
27
32
       return (defaultx, defaulty)
28
33
 
29
 
   h = ctypes.windll.kernel32.GetStdHandle(-11)
 
34
   # To avoid problem with redirecting output via pipe
 
35
   # need to use stderr instead of stdout
 
36
   h = ctypes.windll.kernel32.GetStdHandle(WIN32_STDERR_HANDLE)
30
37
   csbi = ctypes.create_string_buffer(22)
31
38
   res = ctypes.windll.kernel32.GetConsoleScreenBufferInfo(h, csbi)
32
39