changeset 25555:838fa1932ff8

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.
author Laurent Charignon <lcharignon@fb.com>
date Fri, 05 Jun 2015 13:32:52 -0700
parents 94441df6206c
children 40f0e9e5b821
files mercurial/crecord.py
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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