Re: Syntax coloring/highlighting in gnu-readline

2014-03-05 Thread solros9
On Monday, March 3, 2014 3:06:57 PM UTC+1, Chet Ramey wrote:
 I have not done any work in this area, and have no immediate plans to.  The
 
 readline internals do not lend themselves to this very well: the line
 
 buffer management and display engines assume that every character in the
 
 line buffer contributes to the screen display and should be displayed.  You
 
 would need an auxiliary data structure to save and manipulate this
 
 information.

Okay, thanks. Do you have any hints on where to start if I want to implement 
this?

Silke


Re: Syntax coloring/highlighting in gnu-readline

2014-03-05 Thread Chet Ramey
On 3/5/14 3:41 AM, solr...@gmail.com wrote:
 On Monday, March 3, 2014 3:06:57 PM UTC+1, Chet Ramey wrote:
 I have not done any work in this area, and have no immediate plans to.  The

 readline internals do not lend themselves to this very well: the line

 buffer management and display engines assume that every character in the

 line buffer contributes to the screen display and should be displayed.  You

 would need an auxiliary data structure to save and manipulate this

 information.
 
 Okay, thanks. Do you have any hints on where to start if I want to implement 
 this?

Sure.  Think about it from a top-down perspective.  You need commands to
allow users to add and remove `colored regions'.  You need a way to
represent those regions, or a way to indicate which parts of rl_line_buffer
should be highlighted.  You need a way to translate those regions into a
representation of a line that should be displayed.  Then you need a way to
tell the redisplay engine in display.c that it should not try and display
the characters but instead write them directly to the terminal and that
they do not take up real estate on the screen.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: Syntax coloring/highlighting in gnu-readline

2014-03-03 Thread Chet Ramey
On 3/2/14 7:16 PM, Solros wrote:
 On Friday, February 10, 2012 4:25:22 PM UTC+1, LanX wrote:

 I'm trying to interactively add colors while typing in readline and

 using rl_event_hook to change rl_line_buffer seems to work.



 Alas the ANSI escape codes for formatting which are allowed in the

 prompt are not interpreted and shown as they are.
 
 I wonder did you manage solve this by now? I want to do the exact same thing 
 and would greatly appreciate any hints.

I have not done any work in this area, and have no immediate plans to.  The
readline internals do not lend themselves to this very well: the line
buffer management and display engines assume that every character in the
line buffer contributes to the screen display and should be displayed.  You
would need an auxiliary data structure to save and manipulate this
information.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: Syntax coloring/highlighting in gnu-readline

2014-03-02 Thread Solros
On Friday, February 10, 2012 4:25:22 PM UTC+1, LanX wrote:
 
 I'm trying to interactively add colors while typing in readline and
 
 using rl_event_hook to change rl_line_buffer seems to work.
 
 
 
 Alas the ANSI escape codes for formatting which are allowed in the
 
 prompt are not interpreted and shown as they are.

I wonder did you manage solve this by now? I want to do the exact same thing 
and would greatly appreciate any hints.

Regards,
Silke


Syntax coloring/highlighting in gnu-readline

2012-03-28 Thread LanX
Hi


From my understanding of 
http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
it's OK to ask gnu-readline questions in this list.

I'm trying to interactively add colors while typing in readline and
using rl_event_hook to change rl_line_buffer seems to work.

Alas the ANSI escape codes for formatting which are allowed in the
prompt are not interpreted and shown as they are.


I learned from the old discussions I googled entering formatting code
would confuse cursor point and history entries.

Any other approach to achieve this?

Maybe a hook which does the final printing when a line is displayed,
where I could inject colors?

Cheers
  Rolf