Skip Menu |

This queue is for tickets about the Term-ReadLine-Perl CPAN distribution.

Report information
The Basics
Id: 26727
Status: open
Priority: 0/
Queue: Term-ReadLine-Perl

People
Owner: Nobody in particular
Requestors: BRONSON [...] cpan.org
Cc:
AdminCc:

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



Subject: No way to re-draw current prompt
I would like my completion routine to be able to print helpful text to screen and then have the prompt printed correctly again. For instance, in the Bash shell, hitting tab twice causes a directory listing to be printed. As far as I can tell, Term::Readline::Perl does not allow my program to print helpful text while completing. It does have a force_redraw variable, which is exactly what is needed, it just doesn't offer any way for my program to set it. Term::ReadLine::Gnu offers the rl_on_new_line function, telling it that the cursor has moved to a new line so the entire prompt needs to be printed again. http://search.cpan.org/~hayashi/Term-ReadLine-Gnu-1.16/Gnu.pm#on_new_line Is there any chance of adding rl_on_new_line to Term::Readline::Perl? Reference: http://rt.cpan.org/Ticket/Display.html?id=26692
Subject: Re: [rt.cpan.org #26727] No way to re-draw current prompt
Date: Thu, 26 Apr 2007 14:01:34 -0700
To: Scott Bronson via RT <bug-Term-ReadLine-Perl [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Thu, Apr 26, 2007 at 04:04:38PM -0400, Scott Bronson via RT wrote: Show quoted text
> I would like my completion routine to be able to print helpful text to > screen and then have the prompt printed correctly again. For instance, > in the Bash shell, hitting tab twice causes a directory listing to be > printed.
Same with Term::ReadLine::Perl. Show quoted text
> As far as I can tell, Term::Readline::Perl does not allow my program to > print helpful text while completing.
See above. Show quoted text
> It does have a force_redraw > variable, which is exactly what is needed, it just doesn't offer any way > for my program to set it.
Is it lexical, or what? Show quoted text
> Term::ReadLine::Gnu offers the rl_on_new_line function, telling it that > the cursor has moved to a new line so the entire prompt needs to be > printed again. > http://search.cpan.org/~hayashi/Term-ReadLine-Gnu-1.16/Gnu.pm#on_new_line
Generally, I hate the (absense of) design of GNU readline API. But it is a precedent anyway, so if nothing more natural emerges, it is an precedent to ba put in the TODO list. But first, convince me it can't be done with the current API. Or: maybe you want to be restricted to the OO API? This is also a laudable goal... Thanks, Ilya
CC: BRONSON [...] cpan.org
Subject: Re: [rt.cpan.org #26727] No way to re-draw current prompt
Date: Tue, 29 May 2007 12:56:05 -0700
To: bug-Term-ReadLine-Perl [...] rt.cpan.org
From: "Scott Bronson" <bronson [...] rinspin.com>
On 4/26/07, Ilya Zakharevich via RT <bug-Term-ReadLine-Perl@rt.cpan.org> wrote: Show quoted text
> > > <URL: http://rt.cpan.org/Ticket/Display.html?id=26727 > > > On Thu, Apr 26, 2007 at 04:04:38PM -0400, Scott Bronson via RT wrote:
> > I would like my completion routine to be able to print helpful text to > > screen and then have the prompt printed correctly again. For instance, > > in the Bash shell, hitting tab twice causes a directory listing to be > > printed.
> > Same with Term::ReadLine::Perl.
Sorry, I used a bad example. Term::ReadLine::Perl makes suggesting potential completions easy, but printing arbitrary suggestion text hard. For instance, say i would like my app to print "<enter an ip address>" instead of displaying completions when the user hits <tab> twice. Easy enough, I can just print the string from the completion callback. The problem is, once I print that helpful string, the cursor position is messed up and (afaict) T-R-Perl offers way to fix it. T-R-Gnu's term->rl_on_new_line() routine indicates that something has been printed and that the completion line needs to be refreshed. Your force_redraw routine does exactly this but it's not exported. As far as I can tell, my application can't call it. Generally, I hate the (absense of) design of GNU readline API. But it Show quoted text
> is a precedent anyway, so if nothing more natural emerges, it is an > precedent to ba put in the TODO list.
Amen to that, it's pretty astoundingly awful. If you come up with something better, I'll certainly use it. Does that make more sense? Sorry for the delay -- an ill-advised switch to Google Apps for your Domain left a few messages buried in an avalanche of spam.
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #26727] No way to re-draw current prompt
Date: Mon, 11 Jun 2007 08:41:57 -0700
To: Scott Bronson via RT <bug-Term-ReadLine-Perl [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Tue, May 29, 2007 at 03:56:59PM -0400, Scott Bronson via RT wrote: Show quoted text
> For instance, say i would like my app to print "<enter an ip address>" > instead of displaying completions when the user hits <tab> twice. Easy > enough, I can just print the string from the completion callback. The > problem is, once I print that helpful string, the cursor position is messed > up and (afaict) T-R-Perl offers way to fix it. > > T-R-Gnu's term->rl_on_new_line() routine indicates that something has been > printed and that the completion line needs to be refreshed. Your > force_redraw routine does exactly this but it's not exported. As far as I > can tell, my application can't call it.
Why??? Do you want it to be available as a method, or how? Show quoted text
> Generally, I hate the (absense of) design of GNU readline API. But it
> > is a precedent anyway, so if nothing more natural emerges, it is an > > precedent to ba put in the TODO list.
The major goal is that a script works without knowing what interface is actually loaded. If one interface defines a name for a useful API, another is more or less forced to use the name... Show quoted text
> Sorry for the delay -- an ill-advised switch to Google Apps for your Domain > left a few messages buried in an avalanche of spam.
my domain? Thanks for your suggestions, Ilya
CC: BRONSON [...] cpan.org
Subject: Re: [rt.cpan.org #26727] No way to re-draw current prompt
Date: Mon, 11 Jun 2007 18:05:16 -0700
To: bug-Term-ReadLine-Perl [...] rt.cpan.org
From: "Scott Bronson" <bronson [...] rinspin.com>
On 6/11/07, Ilya Zakharevich via RT <bug-Term-ReadLine-Perl@rt.cpan.org> wrote: Show quoted text
> > > <URL: http://rt.cpan.org/Ticket/Display.html?id=26727 > > > On Tue, May 29, 2007 at 03:56:59PM -0400, Scott Bronson via RT wrote:
> > For instance, say i would like my app to print "<enter an ip address>" > > instead of displaying completions when the user hits <tab> twice. Easy > > enough, I can just print the string from the completion callback. The > > problem is, once I print that helpful string, the cursor position is
> messed
> > up and (afaict) T-R-Perl offers way to fix it. > > > > T-R-Gnu's term->rl_on_new_line() routine indicates that something has
> been
> > printed and that the completion line needs to be refreshed. Your > > force_redraw routine does exactly this but it's not exported. As far as
> I
> > can tell, my application can't call it.
> > Why??? Do you want it to be available as a method, or how?
As a method named rl_on_new_line() like Term::ReadLine::Gnu provides would be easiest for me. But, really, I just need some way to force the prompt to re-draw itself from scratch (so, as I said, the completion routine can print arbitrary text). However you choose to provide something like this fine by me. Show quoted text
> Sorry for the delay -- an ill-advised switch to Google Apps for your > Domain
> > left a few messages buried in an avalanche of spam.
> > my domain?
"Google Apps for Your Domain" for my domain. :) - Scott
CC: undisclosed-recipients: ;
Subject: Re: [rt.cpan.org #26727] No way to re-draw current prompt
Date: Tue, 12 Jun 2007 09:05:54 -0700
To: Scott Bronson via RT <bug-Term-ReadLine-Perl [...] rt.cpan.org>
From: Ilya Zakharevich <nospam-abuse [...] ilyaz.org>
On Mon, Jun 11, 2007 at 09:05:32PM -0400, Scott Bronson via RT wrote: Show quoted text
> > Why??? Do you want it to be available as a method, or how?
> > > As a method named rl_on_new_line() like Term::ReadLine::Gnu provides would > be easiest for me. But, really, I just need some way to force the prompt to > re-draw itself from scratch (so, as I said, the completion routine can print > arbitrary text). However you choose to provide something like this fine by > me.
So it is available to you now (as you say, force_update() should work (sp?)), only you need to check the name of the driver. Show quoted text
>>>TODO.
Ilya