crecord: extract ui refresh code after editing of hunk in a function
This is useful to reuse the logic to implement the continuation of the crecord
session if the user edits a hunk and the editor exits with a non-zero status.
--- a/mercurial/crecord.py Thu Jun 11 15:45:02 2015 -0700
+++ b/mercurial/crecord.py Fri Jun 05 13:32:52 2015 -0700
@@ -1419,6 +1419,13 @@
"""
edit the currently chelected chunk
"""
+ def updateui(self):
+ self.numpadlines = self.getnumlinesdisplayed(ignorefolding=True) + 1
+ self.chunkpad = curses.newpad(self.numpadlines, self.xscreensize)
+ self.updatescroll()
+ self.stdscr.refresh()
+ self.statuswin.refresh()
+ self.stdscr.keypad(1)
def editpatchwitheditor(self, chunk):
if chunk is None:
@@ -1501,12 +1508,7 @@
self.currentselecteditem = header
if not test:
- self.numpadlines = self.getnumlinesdisplayed(ignorefolding=True) + 1
- self.chunkpad = curses.newpad(self.numpadlines, self.xscreensize)
- self.updatescroll()
- self.stdscr.refresh()
- self.statuswin.refresh()
- self.stdscr.keypad(1)
+ updateui(self)
def emptypatch(self):
item = self.headerlist