From 87f871f40a796072b79b442af51b471bb4e95278 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sat, 29 Jan 2011 12:37:19 +0000 Subject: [PATCH] Fix #1500 - Console crashes on command longer than terminal width. This error is raised if the cursor is off screen and is supressed with try-except --- deluge/ui/console/screen.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/deluge/ui/console/screen.py b/deluge/ui/console/screen.py index bf6b53190..7ea7cb785 100644 --- a/deluge/ui/console/screen.py +++ b/deluge/ui/console/screen.py @@ -250,7 +250,11 @@ class Screen(CursesStdIO): if index + 1 == len(parsed): # This is the last string so lets append some " " to it s += " " * (self.cols - (col + len(s)) - 1) - self.stdscr.addstr(row, col, s, color) + try: + self.stdscr.addstr(row, col, s, color) + except curses.error: + pass + col += len(s) def refresh(self): @@ -287,7 +291,10 @@ class Screen(CursesStdIO): self.add_string(self.rows - 1, self.input) # Move the cursor - self.stdscr.move(self.rows - 1, self.input_cursor) + try: + self.stdscr.move(self.rows - 1, self.input_cursor) + except curses.error: + pass self.stdscr.redrawwin() self.stdscr.refresh() @@ -426,7 +433,10 @@ class Screen(CursesStdIO): # Update the input string on the screen self.add_string(self.rows - 1, self.input) - self.stdscr.move(self.rows - 1, self.input_cursor) + try: + self.stdscr.move(self.rows - 1, self.input_cursor) + except curses.error: + pass self.stdscr.refresh() def close(self):