Skip Menu |

This queue is for tickets about the CursesWidgets CPAN distribution.

Report information
The Basics
Id: 27029
Status: open
Priority: 0/
Queue: CursesWidgets

People
Owner: Nobody in particular
Requestors: mkoren [...] wp.pl
Cc:
AdminCc:

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



Subject: TextMemo and \n
Date: Wed, 09 May 2007 18:10:50 +0200
To: bug-CursesWidgets [...] rt.cpan.org
From: Mateusz Koreń <mkoren [...] wp.pl>
I tried to insert enter sign (i.e. \n) into a Curses::Widgets::TextMemo instance and found that, however I can do it on initialization in the VALUE => "smth\nsmth", I cannot do it using the input_key method, which is a bit of a pain in the ass, even if there is (and I haven't found it) a simple way to insert \n into it, because I have to service this key separately in my every instance. I isolated the problem in TextMemo.pm input_key method in the line 440: return if $ro || $in !~ /^[[:print:]]$/; Are there any reasons for this line (especially regarding the next one)? Is there any simple workaround using the unchanged library? System information (if useful anyhow): Ubuntu 6.06 LTS 2.6.15-28-amd64-k8 #1 SMP PREEMPT perl 5.8.7-10ubuntu1 libcurses-widgets-perl 1.997-2 ---------------------------------------------------- Ekstraliga żużlowa - sprawdź koniecznie kolejne rozgrywki! Kliknij: http://klik.wp.pl/?adr=www.ekstraliga.wp.pl&sid=1129
From: Krzysztof Drewniak <krzysdrewniak [...] gmail.com>
On Wed May 09 12:11:39 2007, mkoren@wp.pl wrote: Show quoted text
> I tried to insert enter sign (i.e. \n) into a >
Curses::Widgets::TextMemo Show quoted text
> instance and found that, however I can do it on initialization in the > VALUE => "smth\nsmth", I cannot do it using the input_key method, which > is a bit of a pain in the ass, even if there is (and I haven't found it) > a simple way to insert \n into it, because I have to service this key > separately in my every instance. I isolated the problem in TextMemo.pm > input_key method in the line 440: > > return if $ro || $in !~ /^[[:print:]]$/; > > Are there any reasons for this line (especially regarding the next one)? > Is there any simple workaround using the unchanged library? >
Here's a patch that works for me. Someone [lease get this to the author so that the problem can be fixed ASAP, because it is a pain in the ass. This is good for me because I can now just easily use a TextMemo is my English project Krzysztof Drewniak
--- TextMemo-old.pm 2009-10-12 12:17:44.000000000 -0500 +++ TextMemo.pm 2009-10-12 12:20:46.000000000 -0500 @@ -437,10 +437,10 @@ sub input_key { # Process other keys } else { - return if $ro || $in !~ /^[[:print:]]$/; + return if $ro || $in !~ /^[[:print:]]|\s$/; # Exit if it's a non-printing character - return unless $in =~ /^[\w\W]$/; + return unless $in =~ /^[\w\W\s]$/; # Reject if we're already at the max length if (defined $max && length($value) == $max) {