curses: eat curses error for weird inputs

Summary:
In python 3 curses sometimes throws an error when weird keys are
pressed. I'm not certain exactly what key causes the problem, but let's just
prevent all such errors from crashing the process.

Reviewed By: quark-zju

Differential Revision: D23310301

fbshipit-source-id: a9684ce6f690d0753ff9956ef9f13c330eb0a77b
This commit is contained in:
Durham Goode 2020-08-24 20:15:15 -07:00 committed by Facebook GitHub Bot
parent 9e9d4a5b2b
commit 4a8a5290e8

View File

@ -1743,9 +1743,15 @@ are you sure you want to review/edit and confirm the selected changes [yn]?
self.helpwindow()
self.stdscr.clear()
self.stdscr.refresh()
elif len(keypressed) == 1 and curses.unctrl(keypressed) in [b"^L"]:
else:
try:
if len(keypressed) == 1 and curses.unctrl(keypressed) in [b"^L"]:
# scroll the current line to the top of the screen
self.scrolllines(self.selecteditemstartline)
except OverflowError:
# curses sometimes throws a "OverflowError: byte doesn't fit in
# chtype" error.
pass
def main(self, stdscr):
"""