duncs has asked for the wisdom of the Perl Monks concerning the following question:
I am seeing "strange" behaviour when trying to grab user input within Curses v1.32.
I have created a small window and put some text in it, then drawn a box around the window - this works fine until I add the code to get input from the user, after which the box is no longer drawn.
I have seen this on Debian Jessie, Debian Lenny and RHEL-6.
Below is a small code example displaying this behaviour. If you run this code without args a box is drawn around the window. Provide an arg to the script so user input is sought and the box is no longer drawn around the window.
Any Curses guru's shed any light on this for me?
#!/usr/bin/perl use strict; use warnings; use Curses; END{ endwin(); }; initscr; curs_set(0); clear(); noecho(); halfdelay(30); my $win1 = Curses->new( 7, 30, 5, 5); $win1->box(ACS_VLINE, ACS_HLINE); my $char = -1; while(1) { $win1->addstr( 2, 2, scalar(localtime)); $win1->addstr( 4, 10, "Char: $char "); $win1->refresh; if(!@ARGV) { sleep 3; } else { $char = getch(); } }
Thanks
Duncs
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Strange Curses behaviour
by Anonymous Monk on Nov 02, 2015 at 19:53 UTC | |
by duncs (Beadle) on Nov 03, 2015 at 09:05 UTC | |
|
Re: Strange Curses behaviour
by thmsdrew (Scribe) on Nov 02, 2015 at 18:42 UTC | |
by Happy-the-monk (Canon) on Nov 02, 2015 at 18:51 UTC |