[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Syntax coloring/highlighting in gnu-readline

From: Chet Ramey
Subject: Re: Syntax coloring/highlighting in gnu-readline
Date: Wed, 05 Mar 2014 09:05:40 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.1.1

On 3/5/14 3:41 AM, address@hidden 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.

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]