##// END OF EJS Templates
util: make wrap() require a width argument...
Matt Mackall -
r12698:7aef77e7 default
parent child Browse files
Show More
@@ -1949,7 +1949,7 b' def help_(ui, name=None, with_version=Fa'
1949 commands = cmds[f].replace("|",", ")
1949 commands = cmds[f].replace("|",", ")
1950 ui.write(" %s:\n %s\n"%(commands, h[f]))
1950 ui.write(" %s:\n %s\n"%(commands, h[f]))
1951 else:
1951 else:
1952 ui.write('%s\n' % (util.wrap(h[f],
1952 ui.write('%s\n' % (util.wrap(h[f], textwidth,
1953 initindent=' %-*s ' % (m, f),
1953 initindent=' %-*s ' % (m, f),
1954 hangindent=' ' * (m + 4))))
1954 hangindent=' ' * (m + 4))))
1955
1955
@@ -2106,7 +2106,7 b' def help_(ui, name=None, with_version=Fa'
2106 if desc:
2106 if desc:
2107 initindent = ' %s%s ' % (opt, ' ' * (hanging - width))
2107 initindent = ' %s%s ' % (opt, ' ' * (hanging - width))
2108 hangindent = ' ' * (hanging + 3)
2108 hangindent = ' ' * (hanging + 3)
2109 ui.write('%s\n' % (util.wrap(desc,
2109 ui.write('%s\n' % (util.wrap(desc, textwidth,
2110 initindent=initindent,
2110 initindent=initindent,
2111 hangindent=hangindent)))
2111 hangindent=hangindent)))
2112 else:
2112 else:
@@ -1313,9 +1313,7 b' class MBTextWrapper(textwrap.TextWrapper'
1313
1313
1314 #### naming convention of above implementation follows 'textwrap' module
1314 #### naming convention of above implementation follows 'textwrap' module
1315
1315
1316 def wrap(line, width=None, initindent='', hangindent=''):
1316 def wrap(line, width, initindent='', hangindent=''):
1317 if width is None:
1318 width = termwidth() - 2
1319 maxindent = max(len(hangindent), len(initindent))
1317 maxindent = max(len(hangindent), len(initindent))
1320 if width <= maxindent:
1318 if width <= maxindent:
1321 # adjust for weird terminal size
1319 # adjust for weird terminal size
General Comments 0
You need to be logged in to leave comments. Login now