changeset 30545:f3cff00c7a00

crecord: make _getstatuslines update numstatuslines We are going to make the text in the status window dynamically generated, so its size would be dynamic. Change getstatuslines to update "numstatuslines" automatically. Fix an issue where "numstatuslines" being 1 makes the chunkpad disappear.
author Jun Wu <quark@fb.com>
date Wed, 23 Nov 2016 22:23:15 +0000
parents d4035372db8d
children 9b674957e2e4
files mercurial/crecord.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/crecord.py	Mon Nov 28 23:12:54 2016 +0000
+++ b/mercurial/crecord.py	Wed Nov 23 22:23:15 2016 +0000
@@ -541,7 +541,7 @@
         # keeps track of the number of lines in the pad
         self.numpadlines = None
 
-        self.numstatuslines = 2
+        self.numstatuslines = 1
 
         # keep a running count of the number of lines printed to the pad
         # (used for determining when the selected item begins/ends)
@@ -955,6 +955,9 @@
                        "(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")]
+        if len(lines) != self.numstatuslines:
+            self.numstatuslines = len(lines)
+            self.statuswin.resize(self.numstatuslines, self.xscreensize)
         return [util.ellipsis(l, self.xscreensize - 1) for l in lines]
 
     def updatescreen(self):
@@ -979,7 +982,7 @@
             self.updatescroll()
             self.chunkpad.refresh(self.firstlineofpadtoprint, 0,
                                   self.numstatuslines, 0,
-                                  self.yscreensize + 1 - self.numstatuslines,
+                                  self.yscreensize - self.numstatuslines,
                                   self.xscreensize)
         except curses.error:
             pass