Module: deluge
Branch: 1.3-stable
Commit: 5f168f3a25fbad6328be0e5fd70ff89b0b98f970

Author: Calum Lind <[email protected]>
Date:   Sat Jan 29 12:37:19 2011 +0000

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 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/deluge/ui/console/screen.py b/deluge/ui/console/screen.py
index ad0da73..2ee8ede 100644
--- a/deluge/ui/console/screen.py
+++ b/deluge/ui/console/screen.py
@@ -248,7 +248,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):
@@ -285,7 +289,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()
 
@@ -424,7 +431,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):

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to