crecord: extract ui refresh code after editing of hunk in a function
authorLaurent Charignon <lcharignon@fb.com>
Fri, 05 Jun 2015 13:32:52 -0700
changeset 25555 838fa1932ff8
parent 25554 94441df6206c
child 25556 40f0e9e5b821
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.
mercurial/crecord.py
--- 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