Also, I'll point out that Spyderlib has a robust QPlainTextEdit based
editor written in Python that does most of what you'd want. It does a lot more than would be necessary but would still be a good starting point. At the very least it's a complete example in Python of what can be accomplished by subclassing a QPlainTextEdit.