From 966ad5afc895793c48cd87d307cff44873c31b21 Mon Sep 17 00:00:00 2001 From: moculus Date: Sun, 29 Jul 2007 03:08:42 +0000 Subject: [PATCH] fixed bug --HG-- branch : pmacs2 --- application.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/application.py b/application.py index 472c96f..9d91337 100755 --- a/application.py +++ b/application.py @@ -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: @@ -526,7 +533,7 @@ class Application(object): slot = self.bufferlist.slots[i] self.draw_slot(i) self.draw_status_bar(i) - + def highlight_char(self, sy, sx, fg='default', bg='default'): junk = self.win.inch(sy, sx) char = junk & 255