News for hackers. Stuff that matters.
Re:Build Your Own Text Editor by jokoon on Thursday April 06, 2017 @02:39AM (#14048431)
I also tried to make an editor 5 years ago, because I was not satisfied by either notepad++ or sublime text. I was checking out notepad++'s code, and I was quite amazed by the fact that making a text editor was not some simple task.

The syntax highlighting functionality alone is a combination of something as complex as what a compiler/parser does, and you have to do it almost in real time.

So if you want to color every different part like operators, symbols, braces, with a different color, and you try to do this on C++, it is not going to be a small task...

Also something you learn about text editors is the rope data structure. https://en.wikipedia.org/wiki/Rope_(data_structure)

Re:Build Your Own Text Editor by davorb on Thursday April 06, 2017 @02:58AM (#14048511)
> So if you want to color every different part like operators, symbols, braces, with a different color, and you try to do this on C++, it is not going to be a small task...

For a lot of modes, Emacs does this using regex.

Re:Build Your Own Text Editor by jokoon on Saturday April 08, 2017 @03:43AM (#14065831)
Running a regex each time you type a character seems a little heavy to me...

Regex'ing languages like HTML or C++ can be quite mind breaking... I think.

Re:Build Your Own Text Editor by thomastjeffery on Friday April 07, 2017 @10:48PM (#14065002)
Ropes are pretty sweet. I still prefer a piece table, just because of the sheer simplicity.