[PATCH] obtain terminal_width via curses

Martin Pool mbp at sourcefrog.net
Tue May 9 08:09:50 BST 2006


On 27 Apr 2006, Robert Widhopf-Fenk <hack at robf.de> wrote:
> > Thanks for the patch.  There is an existing bug open for this,
> > https://launchpad.net/products/bzr/+bug/3507
> > 
> > That bug suggests using TIOCGWINSZ to do this, rather than curses,  
> > which is at least conceptually more lightweight.  Are there any  
> > particular advantages to using curses?
> 
> That was the first thing I found working, but I also found
> reasons against it, flickering, strange buffering, but the
> biggest one: if it fails to open the terminal it will _exit()
> the python interpreter.
> 
> Attached is a diff with the code from Gustavo.  This now works
> for me in Konsole, XTerm, (X)Emacs shell/term. 
> 
> With Robeys patch I get an assertion error in the XEmacs
> shell since the width returned by ioctl is 0, thus my patch
> tries to fix that.  I also added the -1 in log.py, but not
> terminal_width() as it does not seem the right place for it.

Thanks, merged.

-- 
Martin




More information about the bazaar mailing list