parent
e0716c5d2c
commit
966ad5afc8
|
@ -382,15 +382,14 @@ class Application(object):
|
||||||
self.error_string = ""
|
self.error_string = ""
|
||||||
self.error_timestamp = None
|
self.error_timestamp = None
|
||||||
def resize_event(self):
|
def resize_event(self):
|
||||||
self.y, self.x = self.stdscr.getmaxyx()
|
(self.y, self.x) = self.stdscr.getmaxyx()
|
||||||
self.resize_slots()
|
self.resize_slots()
|
||||||
def resize_slots(self):
|
def resize_slots(self):
|
||||||
n = len(self.bufferlist.slots)
|
n = len(self.bufferlist.slots)
|
||||||
assert n > 0
|
assert n > 0
|
||||||
x = self.x - 1
|
x = self.x - 1
|
||||||
y_sum = self.y - 1 - n
|
y_sum = self.y - 1 - n
|
||||||
# XYZ this method seems broken
|
self.bufferlist.resize(y_sum, x)
|
||||||
self.bufferlist.resize(x, y_sum)
|
|
||||||
|
|
||||||
# exit
|
# exit
|
||||||
def exit(self):
|
def exit(self):
|
||||||
|
@ -459,6 +458,9 @@ class Application(object):
|
||||||
if self.error_timestamp is not None and ERROR_TIMEOUT > 0 and \
|
if self.error_timestamp is not None and ERROR_TIMEOUT > 0 and \
|
||||||
time.time() - self.error_timestamp > ERROR_TIMEOUT:
|
time.time() - self.error_timestamp > ERROR_TIMEOUT:
|
||||||
self.clear_error()
|
self.clear_error()
|
||||||
|
(y, x) = self.stdscr.getmaxyx()
|
||||||
|
if y != self.y or x != self.x:
|
||||||
|
self.resize_event()
|
||||||
|
|
||||||
# clear the error line; it might look confusing to the user
|
# clear the error line; it might look confusing to the user
|
||||||
try:
|
try:
|
||||||
|
@ -477,11 +479,16 @@ class Application(object):
|
||||||
|
|
||||||
# full screen drawer
|
# full screen drawer
|
||||||
def draw(self):
|
def draw(self):
|
||||||
|
try:
|
||||||
self.draw_slots()
|
self.draw_slots()
|
||||||
self.draw_input_bar()
|
self.draw_input_bar()
|
||||||
self.draw_cursor()
|
self.draw_cursor()
|
||||||
self.win.noutrefresh()
|
self.win.noutrefresh()
|
||||||
curses.doupdate()
|
curses.doupdate()
|
||||||
|
except:
|
||||||
|
# ok, so there was a problem...
|
||||||
|
# let's see if the screen changed sizes and if so, resize our slots
|
||||||
|
self.resize_event()
|
||||||
|
|
||||||
def draw_cursor(self):
|
def draw_cursor(self):
|
||||||
if self.mini_active:
|
if self.mini_active:
|
||||||
|
|
Loading…
Reference in New Issue