Re: [patch] Regexp search and replace support in Scintilla



On Mon, Aug 13, 2001 at 06:22:53PM +1000, Neil Hodgson wrote:
> Gustavo M. Giráldez:
> > * As the regexp matching has to be done off the scintilla widget,
> > the implementation uses a scrolling window (of WINDOW_SIZE characters,
> > currently 2048) to perform the searches.  So, you can't match a longer
> > string.
> 
>    For both internal and external use Scintilla provides Accessor classes to
> manage access to the buffer using a movable (in both directions) window over
> the text. DocumentAccessor is for internal use where the internal Document
> class is visible and WindowAccessor is for external use. The windowing
> should be completely transparent (modulo speed) allowing client code to
> believe it has random access to the text. The first Accessor class was
> written specifcally to interface with an existing RE library but it has
> since been more extensively used when writing lexers.
> 
>    If you don't want to use one of the existing Accessor classes, perhaps
> because they are C++ or too bulky, you may want to consider a couple of the
> design decisions in Accessor. All character retrieval is through a generally
> inlined operator[] method call (or alternate SafeGetCharAt which checks
> bounds) so window movement is completely transparent to the client. When the
> window has to be moved it is positioned so that the requested position is
> 1/8th of the way through the buffer, so both forward and backward movement
> through the buffer is reasonably fast rather than requiring constant
> refilling for backwards iteration.

Thanks a lot for the hints.  Unfortunately, these solutions don't apply
in this case, as regexec expects a full character buffer, so I used the
GETTEXTRANGE message to get chunks.  It's certainly not transparent, but
that's not much important here, as the buffer is swept only once and is
rebuilt in every search (as the user is allowed to interact in between).
The exception is subexpression replacement, but it would be overkill to
implement such advanced features just for that :-)

Regards,

Gustavo

> 
>    Neil
> 
> 
> 
> _______________________________________________
> gnome-devtools mailing list
> gnome-devtools gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-devtools
> 




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