Skip to content

Commit

Permalink
Made console buffer more dynamic (close #21)
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Sep 30, 2019
1 parent b843f8f commit a6cba78
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions CurseBreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def start(self):
break
if not keypress:
if len(self.core.config['Addons']) > 35:
self.setup_console(True)
self.setup_console(len(self.core.config['Addons']))
self.print_header()
try:
self.c_update(None, True)
Expand All @@ -119,7 +119,7 @@ def start(self):
os.system('pause')
sys.exit(0)
self.setup_completer()
self.setup_console(True)
self.setup_console(len(self.core.config['Addons']))
self.print_header()
printft(HTML('Use command <ansigreen>help</ansigreen> or press <ansigreen>TAB</ansigreen> to see a list of avai'
'lable commands.\nCommand <ansigreen>exit</ansigreen> or pressing <ansigreen>CTRL+D</ansigreen> wi'
Expand Down Expand Up @@ -185,10 +185,10 @@ def print_header(self):
printft(HTML(f'<ansibrightblack>~~~ <ansibrightgreen>CurseBreaker</ansibrightgreen> <ansibrightred>v'
f'{__version__}</ansibrightred> ~~~</ansibrightblack>\n'))

def setup_console(self, buffer=False):
def setup_console(self, buffer=0):
if getattr(sys, 'frozen', False):
if buffer:
windll.kernel32.SetConsoleScreenBufferSize(self.chandle, wintypes._COORD(100, 100))
if buffer > 0:
windll.kernel32.SetConsoleScreenBufferSize(self.chandle, wintypes._COORD(100, 100 + round(buffer, -2)))
else:
windll.kernel32.SetConsoleWindowInfo(self.chandle, True, byref(wintypes.SMALL_RECT(0, 0, 99, 49)))
windll.kernel32.SetConsoleScreenBufferSize(self.chandle, wintypes._COORD(100, 50))
Expand Down

0 comments on commit a6cba78

Please sign in to comment.