##// 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 def formatblock(block, width):
280 def formatblock(block, width):
281 """Format a block according to width."""
281 """Format a block according to width."""
282 if width <= 0:
283 width = 78
282 indent = ' ' * block['indent']
284 indent = ' ' * block['indent']
283 if block['type'] == 'margin':
285 if block['type'] == 'margin':
284 return ''
286 return ''
@@ -1274,6 +1274,9 b' def termwidth():'
1274 def wrap(line, hangindent, width=None):
1274 def wrap(line, hangindent, width=None):
1275 if width is None:
1275 if width is None:
1276 width = termwidth() - 2
1276 width = termwidth() - 2
1277 if width <= hangindent:
1278 # adjust for weird terminal size
1279 width = max(78, hangindent + 1)
1277 padding = '\n' + ' ' * hangindent
1280 padding = '\n' + ' ' * hangindent
1278 return padding.join(textwrap.wrap(line, width=width - hangindent))
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