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

This commit is contained in:
Calum Lind 2011-01-29 12:37:19 +00:00
parent 9f3ac37f25
commit 87f871f40a
1 changed files with 13 additions and 3 deletions

View File

@ -250,7 +250,11 @@ class Screen(CursesStdIO):
if index + 1 == len(parsed): if index + 1 == len(parsed):
# This is the last string so lets append some " " to it # This is the last string so lets append some " " to it
s += " " * (self.cols - (col + len(s)) - 1) s += " " * (self.cols - (col + len(s)) - 1)
try:
self.stdscr.addstr(row, col, s, color) self.stdscr.addstr(row, col, s, color)
except curses.error:
pass
col += len(s) col += len(s)
def refresh(self): def refresh(self):
@ -287,7 +291,10 @@ class Screen(CursesStdIO):
self.add_string(self.rows - 1, self.input) self.add_string(self.rows - 1, self.input)
# Move the cursor # Move the cursor
try:
self.stdscr.move(self.rows - 1, self.input_cursor) self.stdscr.move(self.rows - 1, self.input_cursor)
except curses.error:
pass
self.stdscr.redrawwin() self.stdscr.redrawwin()
self.stdscr.refresh() self.stdscr.refresh()
@ -426,7 +433,10 @@ class Screen(CursesStdIO):
# Update the input string on the screen # Update the input string on the screen
self.add_string(self.rows - 1, self.input) self.add_string(self.rows - 1, self.input)
try:
self.stdscr.move(self.rows - 1, self.input_cursor) self.stdscr.move(self.rows - 1, self.input_cursor)
except curses.error:
pass
self.stdscr.refresh() self.stdscr.refresh()
def close(self): def close(self):