[PATCH 2 of 5] crecord: make _getstatuslines update numstatuslines

Jun Wu quark at fb.com
Mon Nov 28 18:52:06 EST 2016


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1479939795 0
#      Wed Nov 23 22:23:15 2016 +0000
# Node ID bb6a5e96a536b37075e1c79f7b74d19dfe671827
# Parent  e48c90823ca48725263c5cc2040827c31d6e447b
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r bb6a5e96a536
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]
 
@@ -980,5 +983,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:


More information about the Mercurial-devel mailing list