crecord: extract most of 'main' into a sub function
There are some setup and cleanup necessary around the main code, that
setup/cleanup code needs multiple adjustments so we extract the core code into
its own function first for clarity.
--- a/mercurial/crecord.py Mon Apr 03 23:13:49 2017 +0900
+++ b/mercurial/crecord.py Sun Mar 26 15:05:12 2017 +0200
@@ -1616,6 +1616,10 @@
origsigwinchhandler = signal.signal(signal.SIGWINCH,
self.sigwinchhandler)
+ return self._main(stdscr)
+ signal.signal(signal.SIGWINCH, origsigwinchhandler)
+
+ def _main(self, stdscr):
self.stdscr = stdscr
# error during initialization, cannot be printed in the curses
# interface, it should be printed by the calling code
@@ -1667,4 +1671,3 @@
keypressed = "foobar"
if self.handlekeypressed(keypressed):
break
- signal.signal(signal.SIGWINCH, origsigwinchhandler)