fixed bug

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-07-29 03:08:42 +00:00
parent e0716c5d2c
commit 966ad5afc8
1 changed files with 16 additions and 9 deletions

View File

@ -382,15 +382,14 @@ class Application(object):
self.error_string = ""
self.error_timestamp = None
def resize_event(self):
self.y, self.x = self.stdscr.getmaxyx()
(self.y, self.x) = self.stdscr.getmaxyx()
self.resize_slots()
def resize_slots(self):
n = len(self.bufferlist.slots)
assert n > 0
x = self.x - 1
y_sum = self.y - 1 - n
# XYZ this method seems broken
self.bufferlist.resize(x, y_sum)
self.bufferlist.resize(y_sum, x)
# exit
def exit(self):
@ -459,6 +458,9 @@ class Application(object):
if self.error_timestamp is not None and ERROR_TIMEOUT > 0 and \
time.time() - self.error_timestamp > ERROR_TIMEOUT:
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
try:
@ -477,11 +479,16 @@ class Application(object):
# full screen drawer
def draw(self):
self.draw_slots()
self.draw_input_bar()
self.draw_cursor()
self.win.noutrefresh()
curses.doupdate()
try:
self.draw_slots()
self.draw_input_bar()
self.draw_cursor()
self.win.noutrefresh()
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):
if self.mini_active: