mercurial/crecord.py
changeset 30546 9b674957e2e4
parent 30545 f3cff00c7a00
child 30547 5129ed3c2548
equal deleted inserted replaced
30545:f3cff00c7a00 30546:9b674957e2e4
   944 
   944 
   945         linesprinted = (xstart + len(t)) / self.xscreensize
   945         linesprinted = (xstart + len(t)) / self.xscreensize
   946         self.linesprintedtopadsofar += linesprinted
   946         self.linesprintedtopadsofar += linesprinted
   947         return t
   947         return t
   948 
   948 
       
   949     def _getstatuslinesegments(self):
       
   950         """-> [str]. return segments"""
       
   951         segments = [
       
   952             _('Select hunks to record'),
       
   953             '-',
       
   954             _('[x]=selected **=collapsed'),
       
   955             _('c: confirm'),
       
   956             _('q: abort'),
       
   957             _('arrow keys: move/expand/collapse'),
       
   958             _('space: select'),
       
   959             _('?: help'),
       
   960         ]
       
   961         return segments
       
   962 
   949     def _getstatuslines(self):
   963     def _getstatuslines(self):
   950         """() -> [str]. return short help used in the top status window"""
   964         """() -> [str]. return short help used in the top status window"""
   951         if self.errorstr is not None:
   965         if self.errorstr is not None:
   952             lines = [self.errorstr, _('Press any key to continue')]
   966             lines = [self.errorstr, _('Press any key to continue')]
   953         else:
   967         else:
   954             lines = [_("SELECT CHUNKS: (j/k/up/dn/pgup/pgdn) move cursor; "
   968             # wrap segments to lines
   955                        "(space/A) toggle hunk/all; (e)dit hunk;"),
   969             segments = self._getstatuslinesegments()
   956                      _(" (f)old/unfold; (c)onfirm applied; (q)uit; (?) help "
   970             width = self.xscreensize
   957                        "| [X]=hunk applied **=folded, toggle [a]mend mode")]
   971             lines = []
       
   972             lastwidth = width
       
   973             for s in segments:
       
   974                 w = encoding.colwidth(s)
       
   975                 sep = ' ' * (1 + (s and s[0] not in '-['))
       
   976                 if lastwidth + w + len(sep) >= width:
       
   977                     lines.append(s)
       
   978                     lastwidth = w
       
   979                 else:
       
   980                     lines[-1] += sep + s
       
   981                     lastwidth += w + len(sep)
   958         if len(lines) != self.numstatuslines:
   982         if len(lines) != self.numstatuslines:
   959             self.numstatuslines = len(lines)
   983             self.numstatuslines = len(lines)
   960             self.statuswin.resize(self.numstatuslines, self.xscreensize)
   984             self.statuswin.resize(self.numstatuslines, self.xscreensize)
   961         return [util.ellipsis(l, self.xscreensize - 1) for l in lines]
   985         return [util.ellipsis(l, self.xscreensize - 1) for l in lines]
   962 
   986