Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#13 Minor readline fixes

closed
nobody
None
5
2007-06-03
2007-04-25
Martin Otte
No

On Mac OSX and linux with the GNU libreadline, if I background gdl with Control-z and then bring it back to the foreground, the terminal appearance becomes messed-up. I believe the problem is due to the way readline and ncurses handle signals when they both use their default signal handlers.

It appears that the only place ncurses is explicitly used in the code is to get the terminal width. If the gnu libreadline library is used, this patch uses readline to get the terminal width and height, and ncurses is not used. Putting gdl to the background and then back to the foreground seems to work ok with this patch.

A second benefit of this patch if GNU libreadline is used is that readline keeps track of the terminal dimensions, so if the terminal window is resized the print command will subsequently format the output nicely to the terminal dimensions.

This patch does 2 things:

1) Move readline initialization into InitGDL so that it is called before TermWidth

2) If have_libreadline, use readline to get the terminal width and height instead of the (n)curses library.

I have only tested this with Mac OSX but see no problems.

Discussion

  • Joel Gales
    Joel Gales
    2007-04-26

    Logged In: YES
    user_id=958613
    Originator: NO

    To get it to work on an x86 I also had to add:

    +#include "stdio.h"

    in the patch file below

    +#include "includefirst.hpp"

    Joel

     
  • Marc Schellens
    Marc Schellens
    2007-06-03

    • status: open --> closed