Your comment about writing a text editor library is precisely what got me started with amp ~10 years ago, where much of its core functionality was extracted here:
https://crates.io/crates/scribe
Good luck with the project! Building a text editor to scratch your own itch is fun.