mercurial/crecord.py
changeset 30544 d4035372db8d
parent 30535 3899c358b45a
child 30545 f3cff00c7a00
--- a/mercurial/crecord.py	Mon Nov 28 04:34:01 2016 -0800
+++ b/mercurial/crecord.py	Mon Nov 28 23:12:54 2016 +0000
@@ -946,6 +946,17 @@
         self.linesprintedtopadsofar += linesprinted
         return t
 
+    def _getstatuslines(self):
+        """() -> [str]. return short help used in the top status window"""
+        if self.errorstr is not None:
+            lines = [self.errorstr, _('Press any key to continue')]
+        else:
+            lines = [_("SELECT CHUNKS: (j/k/up/dn/pgup/pgdn) move cursor; "
+                       "(space/A) toggle hunk/all; (e)dit hunk;"),
+                     _(" (f)old/unfold; (c)onfirm applied; (q)uit; (?) help "
+                       "| [X]=hunk applied **=folded, toggle [a]mend mode")]
+        return [util.ellipsis(l, self.xscreensize - 1) for l in lines]
+
     def updatescreen(self):
         self.statuswin.erase()
         self.chunkpad.erase()
@@ -954,25 +965,13 @@
 
         # print out the status lines at the top
         try:
-            if self.errorstr is not None:
-                printstring(self.statuswin, self.errorstr, pairname='legend')
-                printstring(self.statuswin, 'Press any key to continue',
-                            pairname='legend')
-                self.statuswin.refresh()
-                return
-            line1 = _("SELECT CHUNKS: (j/k/up/dn/pgup/pgdn) move cursor; "
-                      "(space/A) toggle hunk/all; (e)dit hunk;")
-            line2 = _(" (f)old/unfold; (c)onfirm applied; (q)uit; (?) help "
-                      "| [X]=hunk applied **=folded, toggle [a]mend mode")
-
-            printstring(self.statuswin,
-                        util.ellipsis(line1, self.xscreensize - 1),
-                        pairname="legend")
-            printstring(self.statuswin,
-                        util.ellipsis(line2, self.xscreensize - 1),
-                        pairname="legend")
+            for line in self._getstatuslines():
+                printstring(self.statuswin, line, pairname="legend")
+            self.statuswin.refresh()
         except curses.error:
             pass
+        if self.errorstr is not None:
+            return
 
         # print out the patch in the remaining part of the window
         try:
@@ -985,9 +984,6 @@
         except curses.error:
             pass
 
-        # refresh([pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol])
-        self.statuswin.refresh()
-
     def getstatusprefixstring(self, item):
         """
         create a string to prefix a line with which indicates whether 'item'