# HG changeset patch # User Jun Wu # Date 2016-08-24 10:24:07 # Node ID bff109e6398a97693ab8133739ccbcd42d71cfaa # Parent 1ea77b75d26696a60153e00586546c3dcf3a716f 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. diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -1263,7 +1263,6 @@ class curseschunkselector(object): 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 @@ are you sure you want to review/edit and 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 @@ are you sure you want to review/edit and keypressed = "foobar" if self.handlekeypressed(keypressed): break + signal.signal(signal.SIGWINCH, origsigwinchhandler)