From 1706b0604baa4e4c9c1b274de95868d3e5c96256 Mon Sep 17 00:00:00 2001
From: Calum Lind <calumlind+deluge@gmail.com>
Date: Sat, 29 Jan 2011 12:37:19 +0000
Subject: [PATCH 2/2] 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 bf6b531..7ea7cb7 100644
a
|
b
|
def add_string(self, row, string):
|
250 | 250 | if index + 1 == len(parsed): |
251 | 251 | # This is the last string so lets append some " " to it |
252 | 252 | s += " " * (self.cols - (col + len(s)) - 1) |
253 | | self.stdscr.addstr(row, col, s, color) |
| 253 | try: |
| 254 | self.stdscr.addstr(row, col, s, color) |
| 255 | except curses.error: |
| 256 | pass |
| 257 | |
254 | 258 | col += len(s) |
255 | 259 | |
256 | 260 | def refresh(self): |
… |
… |
def refresh(self):
|
287 | 291 | self.add_string(self.rows - 1, self.input) |
288 | 292 | |
289 | 293 | # Move the cursor |
290 | | self.stdscr.move(self.rows - 1, self.input_cursor) |
| 294 | try: |
| 295 | self.stdscr.move(self.rows - 1, self.input_cursor) |
| 296 | except curses.error: |
| 297 | pass |
291 | 298 | self.stdscr.redrawwin() |
292 | 299 | self.stdscr.refresh() |
293 | 300 | |
… |
… |
def _doRead(self):
|
426 | 433 | |
427 | 434 | # Update the input string on the screen |
428 | 435 | self.add_string(self.rows - 1, self.input) |
429 | | self.stdscr.move(self.rows - 1, self.input_cursor) |
| 436 | try: |
| 437 | self.stdscr.move(self.rows - 1, self.input_cursor) |
| 438 | except curses.error: |
| 439 | pass |
430 | 440 | self.stdscr.refresh() |
431 | 441 | |
432 | 442 | def close(self): |