--- a/mercurial/minirst.py Thu Sep 03 02:42:56 2009 +0200
+++ b/mercurial/minirst.py Thu Sep 03 21:07:06 2009 +0200
@@ -279,6 +279,8 @@
def formatblock(block, width):
"""Format a block according to width."""
+ if width <= 0:
+ width = 78
indent = ' ' * block['indent']
if block['type'] == 'margin':
return ''
--- a/mercurial/util.py Thu Sep 03 02:42:56 2009 +0200
+++ b/mercurial/util.py Thu Sep 03 21:07:06 2009 +0200
@@ -1274,6 +1274,9 @@
def wrap(line, hangindent, width=None):
if width is None:
width = termwidth() - 2
+ if width <= hangindent:
+ # adjust for weird terminal size
+ width = max(78, hangindent + 1)
padding = '\n' + ' ' * hangindent
return padding.join(textwrap.wrap(line, width=width - hangindent))