On Mon, Sep 19, 2016 at 04:18:14AM -0700, elextr wrote:
> > Should be easy, and should also be how the program is implemented.
> and how do you keep all this updated and in sync with changes to the
> buffer as its edited?

The layered model - the bottom layer is the text/ raw utf8 stream.

The next layers are the indexing layers for various purposes as and when

An index is not just an array of "locations" of course since when the
underlying text stream is inserted into or deleted from (in terms of
bytes, not graphemes), then of course the corresponding index in the
upper layer also needs to be updated.

Now because when an index point gets updated it is that all subsequent
index points also need to be updated, a tree structure for the indexes
is required.

And because the underlying layer can change, even it needs to be
represented by a tree structure (various blocks of text are the leaves
of the tree).

This is basic Comp Sci - thus the "easy" bit. The text editor data
structure is really the simplest useful program, and the data structures
needed to handle "large" (anything other than trivial sized) text files,
are well understood, well studied, and highly optimized.

> > At least, that's how a superior programmer would implement it ;)
> Most of the features you describe are handled by the Scintilla editing
> component which is a separate project at www.scintilla.org and I am
> sure they would be delighted to hear how a "superior" programmer would
> re-implement their library. :)

Ah ok. An external dependency.

Well :)

Guess who needs to advise them their data structures are inferior then
hey? :D

Enjoy the ride, and to ease your communications with your upstream
dependency, I suggest being exceptionally blunt with your "inferior
structures" communications, and to top it off, don't stop at the code
but go on to point large accusatory fingers at the personal life choices
of the programmers involved.

That should speed up the re-implementation.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:

Reply via email to