Skip to content

Commit

Permalink
Merge pull request #103 from AVEgame/resize
Browse files Browse the repository at this point in the history
only resize the terminal if it is the wrong size
  • Loading branch information
mscroggs authored Jul 4, 2020
2 parents aaebd0d + 0fd5b9b commit f1eec11
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ave/display/curses_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ class CursesScreen(Screen):

def __init__(self):
"""Make the screen."""
print("\x1b[8;" + str(HEIGHT) + ";" + str(WIDTH) + "t")
self.stdscr = curses.initscr()

try:
curses.resizeterm(HEIGHT, WIDTH)
# Resize terminal iff it is too small
y, x = self.stdscr.getmaxyx()
if y < HEIGHT or x < WIDTH:
print("\x1b[8;" + str(HEIGHT) + ";" + str(WIDTH) + "t")
curses.resizeterm(HEIGHT, WIDTH)
except AttributeError:
# Windows
pass
Expand Down

0 comments on commit f1eec11

Please sign in to comment.