# HG changeset patch
# User Jun Wu <qu...@fb.com>
# Date 1479939795 0
#      Wed Nov 23 22:23:15 2016 +0000
# Node ID d84ab5920899a914a225319130937befc6402d8a
# Parent  5894c146af1e3154f7b327dce54a779bb419811a
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r d84ab5920899
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.

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -542,5 +542,5 @@ class curseschunkselector(object):
         self.numpadlines = None
 
-        self.numstatuslines = 2
+        self.numstatuslines = 1
 
         # keep a running count of the number of lines printed to the pad
@@ -956,4 +956,7 @@ class curseschunkselector(object):
                      _(" (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]
 
@@ -979,5 +982,5 @@ class curseschunkselector(object):
             self.chunkpad.refresh(self.firstlineofpadtoprint, 0,
                                   self.numstatuslines, 0,
-                                  self.yscreensize + 1 - self.numstatuslines,
+                                  self.yscreensize - self.numstatuslines,
                                   self.xscreensize)
         except curses.error:
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to