Russell Sim <russell....@gmail.com> added the comment:

Hi,

I am having the same problem while running ipython in a batch mode emacs.  
Apparently you can't even start ipython if the columns are less than 27, since 
they use the argparse library for the magic method help printing and they 
preformat the strings at import time. So importing the library fails. :(

I have a simple patch that fixes it but from what i can tell if you set the 
columns to 10 or 1000 there is no effect on the output, so i wonder if it even 
pays any attention to the width during rendering.

If you think it's of value I am happy to write tests. Or if someone has a 
better implementation idea I'll be happy to implement it, but if you are on a 
terminal that is getting <27 characters then you can't really expect the 
formmating of the messages to be that readable.

--- cpython/Lib/argparse.py     2012-07-22 12:10:42.751869655 +1000
+++ /tmp/ediff3953qkY   2012-07-22 12:54:51.380700044 +1000
@@ -95,6 +95,7 @@
 def _callable(obj):
     return hasattr(obj, '__call__') or hasattr(obj, '__bases__')
 
+MIN_WIDTH = 10
 
 SUPPRESS = '==SUPPRESS=='
 
@@ -486,7 +487,10 @@
         # determine the required width and the entry label
         help_position = min(self._action_max_length + 2,
                             self._max_help_position)
-        help_width = self._width - help_position
+        if self._width - help_position > MIN_WIDTH:
+            help_width = self._width - help_position
+        else:
+            help_width = MIN_WIDTH
         action_width = help_position - self._current_indent - 2
         action_header = self._format_action_invocation(action)

----------
nosy: +Russell.Sim
versions: +Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13720>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to