Interesting project.
Processing’s text display primitives are not designed with text editing in mind.
If you want to mix text editor features with Processing features (drawing / multimedia etc.) then you can incorporate Java swing / awt in order to include non-processing text edit and display components. Here is a good previous discussion with @quark that includes practical examples.
If you just want to write a text editor like Notepad++, and you want to use a Processing-like language, I’d recommend doing it directly in Java. There are plenty of starter “text editor in Java” projects out there that you can use as a beginning template, then customize with the features you want.
Trying to create a programming text editor inside a Processing sketch is a bit like trying to build a swimming pool inside a limousine. It is absolutely possible! …just more difficult and more limited.