Building a text editor view

I’m trying to create a Gtk4 UI for a text editor that already works on the terminal. It’s intended as a editor for code and other plain-text formats (including syntax-highlighting, indentation, support for language servers and so on). As I don’t know much about Gtk, I’m looking for some guidance.

Because the editor already determines where each character will be, the view is simple, probably much simpler than a GtkTextView.

It’s similar to Emacs, an editor that recently added a “Pure GTK” UI doing something just like that. As I understand from a presentation done by an Emacs developer, they created a custom widget based on GtkFixed.

So my current ideas are reading the GtkTextView code to see how it’s implemented (though it’s probably more complex than I need) and/or reading the Emacs source code to see how they do it.

Any other suggestions or pointers, including how to learn the concepts I will need to implement such a view, are appreciated. I’m a novice at Gtk but an experienced developer.

There is also:

Note that it doesn’t yet support GTK4. However, given it has several backends and GTK is just one of them, it might indeed be a useful source of inspiration for doing this.
Note however that Scintilla manages a lot outside its GUI backends, including font and surface abstraction and many more, which makes some of its backend code potentially more complex than otherwise necessary.

Thanks, I will take a look.

Also I found this series of posts on the official GTK blog that I think will be helpful:
Custom Widgets in GTK 4