On Wed, 23 Nov 2016 23:24:39 +0000, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <qu...@fb.com>
> # Date 1479926126 0
> #      Wed Nov 23 18:35:26 2016 +0000
> # Node ID 5894c146af1e3154f7b327dce54a779bb419811a
> # Parent  ed629f77d3616013c8216d99e90e02c47eccdb4f
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r 
> 5894c146af1e
> crecord: move status window text calculation to a separate method
> 
> We will do some changes there in the next patches. The new method would also
> be the "source of truth" of the content of the status window (so if the
> status window needs more than 2 lines, it would be calculated from the new
> method).
> 
> diff --git a/mercurial/crecord.py b/mercurial/crecord.py
> --- a/mercurial/crecord.py
> +++ b/mercurial/crecord.py
> @@ -947,4 +947,15 @@ class curseschunkselector(object):
>          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()
> @@ -955,21 +966,8 @@ class curseschunkselector(object):
>          # print out the status lines at the top
>          try:
> +            for line in self._getstatuslines():
> +                printstring(self.statuswin, line, pairname="legend")
>              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

Don't we need statuswin.refresh() here?
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to