comparison mercurial/util.py @ 37083:bad90b80b315

util: adjust indent level in wrap()
author Yuya Nishihara <yuya@tcha.org>
date Thu, 22 Mar 2018 21:14:12 +0900
parents 736024df4498
children 191cba70fe27
comparison
equal deleted inserted replaced
37082:736024df4498 37083:bad90b80b315
2881 maxindent = max(len(hangindent), len(initindent)) 2881 maxindent = max(len(hangindent), len(initindent))
2882 if width <= maxindent: 2882 if width <= maxindent:
2883 # adjust for weird terminal size 2883 # adjust for weird terminal size
2884 width = max(78, maxindent + 1) 2884 width = max(78, maxindent + 1)
2885 line = line.decode(pycompat.sysstr(encoding.encoding), 2885 line = line.decode(pycompat.sysstr(encoding.encoding),
2886 pycompat.sysstr(encoding.encodingmode)) 2886 pycompat.sysstr(encoding.encodingmode))
2887 initindent = initindent.decode(pycompat.sysstr(encoding.encoding), 2887 initindent = initindent.decode(pycompat.sysstr(encoding.encoding),
2888 pycompat.sysstr(encoding.encodingmode)) 2888 pycompat.sysstr(encoding.encodingmode))
2889 hangindent = hangindent.decode(pycompat.sysstr(encoding.encoding), 2889 hangindent = hangindent.decode(pycompat.sysstr(encoding.encoding),
2890 pycompat.sysstr(encoding.encodingmode)) 2890 pycompat.sysstr(encoding.encodingmode))
2891 wrapper = _MBTextWrapper(width=width, 2891 wrapper = _MBTextWrapper(width=width,
2892 initial_indent=initindent, 2892 initial_indent=initindent,
2893 subsequent_indent=hangindent) 2893 subsequent_indent=hangindent)
2894 return wrapper.fill(line).encode(pycompat.sysstr(encoding.encoding)) 2894 return wrapper.fill(line).encode(pycompat.sysstr(encoding.encoding))
2895 2895