~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/win32console.py

Added more docs

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
 
 
21
16
def get_console_size(defaultx=80, defaulty=25):
22
17
   """ Return size of current console.
23
18
 
31
26
       # no ctypes is found
32
27
       return (defaultx, defaulty)
33
28
 
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)
 
29
   h = ctypes.windll.kernel32.GetStdHandle(-11)
37
30
   csbi = ctypes.create_string_buffer(22)
38
31
   res = ctypes.windll.kernel32.GetConsoleScreenBufferInfo(h, csbi)
39
32