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 |