There are times when subtlety is useful, but at other times, you just
have to be blunt.
Below is a reminder to some kind folks of this simple fact.
For the full conversation, see here:
"fails to open Microsoft UTF-16LE file (MSO Word CUSTOM.DIC dictionary
file) #1238"
https://github.com/geany/geany/issues/1238
----- Forwarded message from Zenaan Harkness
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 needed. 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. ----- End forwarded message -----