Apply the Open/Closed Principle and plugin architecture patterns to design a text editor whose core is stable and all features are added via plugins.
Design the core TextDocument (buffer, cursor, selection) and EditorView classes. Apply the MVC pattern: EditorController handles commands, TextDocument is the model, EditorView renders state. Keep the core free of any feature-specific logic.