Re: How to edit a text file =?UTF-8?Q?=3F?=
Sam <sam@email-scan.com> writes:
It took me about a year to write a fully functional text
editor component
It does not take a year to write a text editor with an
interface that is akin to EDLIN of MS-DOS or ED/EX for
UNIX and only some basic fatures, it can even be written
in portable C++!
However, one needs at least a medium level of C++
competence.
One can start to write such an editor with a careful
separation of the model component (which I call the ?edit
engine?) and the UI component.
The initial edit engine does not need to use fancy data
structures like gap buffers or ropes, just a single C++
::std::string. But it has an interface (a pure abstract
class in C++).
One can have a working editor in a day (a simple text
command UI for modifications to a single instance of
::std::string).
With regular expressions in C++11, it is more simple to
implement RE find and replace operations (I guess, I
have not tried C++11's regular expressions yet).
The better support for UTF-8 in C++11 also might help.
More operations can be added from day to day as seen fit.
Eventually, it is possible to add fancy editor data
structure like gap buffers (when ::std::string was observed
to be too slow) or a GUI, without changing the interface of
the edit engine.