Skip Menu |

This queue is for tickets about the Roguelike-Utils CPAN distribution.

Report information
The Basics
Id: 65826
Status: resolved
Priority: 0/
Queue: Roguelike-Utils

People
Owner: Nobody in particular
Requestors: andrew.pennebaker [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: After using Roguelike::Console, terminal keys don't show up
After creating a Console object: my $con = Games::Roguelike::Console->new; When my Perl script ends, the terminal doesn't display my typed keys. Analysis Apparently, Console and/or Curses set the tty to -echo, which hides my keys. Solution Initializing the console messes up any signal handlers I've set up, so I just call reset_signals after that. The stty command is the key (pun intended) to displaying keys again. sub reset_signals { $SIG{INT} = sub { undef $con; # Allow terminal echo if ($^O =~ /linux|darwin/) { my $tty = POSIX::ttyname(1); system "stty -f $tty icanon echo"; } exit 0; }; } sub main { $con = Games::Roguelike::Console::ANSI->new; reset_signals; # ... } Conclusion Could you put the critical portions of reset_signals in Console's SIGINT handler? Also, could you figure out the equivalent fix for Windows? stty is a Unix command. Specs: Roguelike::Console 0.4.256 Perl 5.10.0 Mac OS X 10.6.6 Cheers, Andrew Pennebaker http://www.yellosoft.us/
From: andrew.pennebaker [...] gmail.com
Also, on Mac OS X, the cursor is not hidden during the Console's operation. And it isn't restored after. So, new code: # Games::Rogulelike and Curses do not quit properly. sub reset_signals { $SIG{INT} = sub { undef $con; # Allow terminal echo if ($^O =~ /linux|darwin/) { my $tty = POSIX::ttyname(1); system "stty -f $tty icanon echo"; # Show the cursor print "\e[?25h"; } exit 0; }; } sub main { $con = Games::Roguelike::Console::ANSI->new; # Force hide the cursor if ($^O =~ /linux|darwin/) { print "\e[?25l"; } reset_signals; # ... }
Please check the new release. I see the issue as well on some linux versions. The new release should fix it. (the CURSES version should not have this bug... cureses endwin should do it for you.)