##// END OF EJS Templates
util, minirst: do not crash with COLUMNS=0
Martin Geisler -
r9417:4c3fb451 default
parent child Browse files
Show More
@@ -279,6 +279,8 b' def addmargins(blocks):'
279 279
280 280 def formatblock(block, width):
281 281 """Format a block according to width."""
282 if width <= 0:
283 width = 78
282 284 indent = ' ' * block['indent']
283 285 if block['type'] == 'margin':
284 286 return ''
@@ -1274,6 +1274,9 b' def termwidth():'
1274 1274 def wrap(line, hangindent, width=None):
1275 1275 if width is None:
1276 1276 width = termwidth() - 2
1277 if width <= hangindent:
1278 # adjust for weird terminal size
1279 width = max(78, hangindent + 1)
1277 1280 padding = '\n' + ' ' * hangindent
1278 1281 return padding.join(textwrap.wrap(line, width=width - hangindent))
1279 1282
General Comments 0
You need to be logged in to leave comments. Login now