mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-11-16 00:28:25 +01:00
Implemented a fallback mode for terminals that report zero width/size.
This commit is contained in:
parent
88c01e62ed
commit
cf8922efe6
1 changed files with 8 additions and 2 deletions
10
terminal.py
10
terminal.py
|
@ -86,12 +86,18 @@ def printb(string):
|
|||
print(__bold__ + string + __normal__)
|
||||
|
||||
def get_size():
|
||||
width = 0
|
||||
height = 0
|
||||
|
||||
if sys.stdout.isatty():
|
||||
current_os = platform.system()
|
||||
|
||||
if current_os == 'Windows':
|
||||
return __get_size_windows__()
|
||||
(width, height) = __get_size_windows__()
|
||||
elif current_os == 'Linux' or current_os == 'Darwin' or current_os.startswith('CYGWIN'):
|
||||
return __get_size_linux__()
|
||||
(width, height) = __get_size_linux__()
|
||||
|
||||
if width > 0 and height > 0:
|
||||
return (width, height)
|
||||
|
||||
return (80, 25)
|
||||
|
|
Loading…
Reference in a new issue