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



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.

   Neil






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