browser: avoid crash if mouse support is off
This commit is contained in:
parent
115fd43f09
commit
4da3081ef6
|
@ -130,7 +130,9 @@ class Browser:
|
||||||
self.screen.clear()
|
self.screen.clear()
|
||||||
self.screen.refresh()
|
self.screen.refresh()
|
||||||
|
|
||||||
curses.mousemask(curses.ALL_MOUSE_EVENTS)
|
mousemask = curses.mousemask(curses.ALL_MOUSE_EVENTS)
|
||||||
|
if mousemask == 0:
|
||||||
|
logging.error("Could not enable mouse support.")
|
||||||
curses.curs_set(0)
|
curses.curs_set(0)
|
||||||
init_colors()
|
init_colors()
|
||||||
|
|
||||||
|
@ -233,7 +235,10 @@ class Browser:
|
||||||
elif curses.ascii.isdigit(char):
|
elif curses.ascii.isdigit(char):
|
||||||
self.handle_digit_input(char)
|
self.handle_digit_input(char)
|
||||||
elif char == curses.KEY_MOUSE:
|
elif char == curses.KEY_MOUSE:
|
||||||
self.handle_mouse(*curses.getmouse())
|
try:
|
||||||
|
self.handle_mouse(*curses.getmouse())
|
||||||
|
except curses.error:
|
||||||
|
pass
|
||||||
elif char == curses.KEY_RESIZE:
|
elif char == curses.KEY_RESIZE:
|
||||||
self.handle_resize()
|
self.handle_resize()
|
||||||
elif char == curses.ascii.ESC: # Can be ESC or ALT char.
|
elif char == curses.ascii.ESC: # Can be ESC or ALT char.
|
||||||
|
|
Reference in a new issue