LanX has asked for the wisdom of the Perl Monks concerning the following question:
Please give me a hint how to manipulate Term::Readline output after it was already printed.
I suppose the trick is to send a control sequence which erases the line and reprints it.
My aim is to hack a proof of concept for syntax highlighting in the perl debugger when used interactively as a shell
From digging into perl5db.pl I can see that Term::Readline is used for reading and a hashref $rl_attribs is used to provide call-back functions like db_complete()
$rl_attribs->{completion_function} = \&db_complete;
So is it possible to provide a similar hook which reacts on word_break_characters and then surrounds the already printed word with control-sequences for coloring?
Examples typing "print" does nothing (printed black) but typing: "print " or "print(" activates a call back which modifies "print" to light blue.
Cheers Rolf
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Interactive post-coloring of readline input?
by chrestomanci (Priest) on Feb 09, 2012 at 10:41 UTC | |
by LanX (Saint) on Feb 09, 2012 at 17:00 UTC | |
Re: Interactive post-coloring of readline input?
by Khen1950fx (Canon) on Feb 09, 2012 at 01:46 UTC | |
by LanX (Saint) on Feb 09, 2012 at 03:41 UTC | |
by andal (Hermit) on Feb 09, 2012 at 10:14 UTC | |
by LanX (Saint) on Feb 09, 2012 at 16:35 UTC | |
Re: Interactive post-coloring of readline input? (SOLVED)
by LanX (Saint) on Feb 09, 2012 at 23:08 UTC |