changeset 29846:bff109e6398a

crecord: restore SIGWINCH handler before return Previously, the SIGWINCH handler does not get cleared and if the commit message editor also needs SIGWINCH handling (like vim), the two SIGWINCH handlers (the editor's, ours) will have a race. And we may erase the editor's screen content. This patch restores SIGWINCH handler to address the above issue.
author Jun Wu <quark@fb.com>
date Wed, 24 Aug 2016 11:24:07 +0100
parents 1ea77b75d266
children 18bac830eef3
files mercurial/crecord.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/crecord.py	Sat Aug 20 23:06:01 2016 +0200
+++ b/mercurial/crecord.py	Wed Aug 24 11:24:07 2016 +0100
@@ -1263,7 +1263,6 @@
             self.statuswin.resize(self.numstatuslines, self.xscreensize)
             self.numpadlines = self.getnumlinesdisplayed(ignorefolding=True) + 1
             self.chunkpad = curses.newpad(self.numpadlines, self.xscreensize)
-            # todo: try to resize commit message window if possible
         except curses.error:
             pass
 
@@ -1589,7 +1588,8 @@
         method to be wrapped by curses.wrapper() for selecting chunks.
         """
 
-        signal.signal(signal.SIGWINCH, self.sigwinchhandler)
+        origsigwinchhandler = signal.signal(signal.SIGWINCH,
+                                            self.sigwinchhandler)
         self.stdscr = stdscr
         # error during initialization, cannot be printed in the curses
         # interface, it should be printed by the calling code
@@ -1640,3 +1640,4 @@
                 keypressed = "foobar"
             if self.handlekeypressed(keypressed):
                 break
+        signal.signal(signal.SIGWINCH, origsigwinchhandler)