Skip Menu |

This queue is for tickets about the IO-Prompter CPAN distribution.

Report information
The Basics
Id: 101877
Status: resolved
Priority: 0/
Queue: IO-Prompter

People
Owner: Nobody in particular
Requestors: lukasz.wrzesinski [...] gmail.com
Cc:
AdminCc:

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



Subject: Escape characters not supported correctly
Date: Mon, 2 Feb 2015 11:56:23 +0100
To: bug-IO-Prompter [...] rt.cpan.org
From: Łukasz Wrzesiński <lukasz.wrzesinski [...] gmail.com>
Found on version: IO-Prompter-0.004011 <http://search.cpan.org/~dconway/IO-Prompter-0.004011/> Everything works fine until special key pressed (escape sequence sent to the console with consumed \e). Looks like escape character is counted but nothing is printed instead of it. When you for example hit one of the arrow keys you will see [A, [B, [C or [D (\e is consumed). Without special characters pressed backspace, Ctrl-B, Ctrl-F, Ctrl-A, Ctrl-E works correctly. Each hit of special key (i.e. arrow keys) allows user to delete one additional char too much (consume prompt message) and totally mess up Ctrl-B, Ctrl-F, Ctrl-A, Ctrl-E behavior. Usually in terminals \e is replaced with ^[ sequence like in the following example: perl -e 'print <STDIN>;' ^[[C Best Regards, -- Łukasz Wrzesiński
Subject: Re: [rt.cpan.org #101877] Escape characters not supported correctly
Date: Tue, 3 Feb 2015 09:54:50 +1100
To: bug-IO-Prompter [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Thanks for the report, Łukasz. Unfortunately, I'm not sure there's much I can do to resolve this issue. I can't find a reliable way to detect the escape sequences used on different systems, and even then, I'm not sure how I could resolve an "arrow" sequence from a genuine <ESC> (which is part of the IO::Prompter interface) followed by a genuine <CTRL-A>. If you have any suggestions, I'd certainly welcome them, but for the moment, the only response I can imagine is to document that arrow keys (and other terminal escape sequences) simply don't work with the module. :-( Damian
Subject: Re: [rt.cpan.org #101877] Escape characters not supported correctly
Date: Tue, 3 Feb 2015 23:18:19 +0100
To: bug-IO-Prompter [...] rt.cpan.org
From: Łukasz Wrzesiński <lukasz.wrzesinski [...] gmail.com>
Hi, There is a way to partially solve it. In function _std_printer_to there are two replacements of \e with an empty strings (for display purposes only). s{\e}{}gxms for @loc; Because of that instead of printing \e[C, \e[D, \e[A, or \e[B or any other escape sequence [C, [D, [A or [B is printed. When you use dash instead of empty string for both replacements in this function everything will work fine: s{\e}{^}gxms for @loc; There will be ^[C, ^[D, ^[A or ^[B printed. Actually escaped \e equivalent on the console is ^[ character sequence, but making it working correctly when \e in input buffer but ^[ displayed is very problematic. I've tried but without success so far. 2015-02-02 23:55 GMT+01:00 damian@conway.org via RT < bug-IO-Prompter@rt.cpan.org>: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=101877 > > > Thanks for the report, Łukasz. > > Unfortunately, I'm not sure there's much I can do to resolve this issue. > > I can't find a reliable way to detect the escape sequences used on > different systems, and even then, I'm not sure how I could resolve > an "arrow" sequence from a genuine <ESC> (which is part of the > IO::Prompter interface) followed by a genuine <CTRL-A>. > > If you have any suggestions, I'd certainly welcome them, but for the > moment, the only response I can imagine is to document that arrow > keys (and other terminal escape sequences) simply don't work with > the module. :-( > > Damian > >
-- Łukasz Wrzesiński
Subject: Re: [rt.cpan.org #101877] Escape characters not supported correctly
Date: Wed, 4 Feb 2015 09:45:43 +1100
To: bug-IO-Prompter [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Aha. So we don't need to support arrows, just de-fang them. Thanks, Łukasz. I've applied your proposed solution and uploaded the new version. Much appreciated! Damian