Emacs-style ranges on a text buffer that I can now hang attributes like color, decorations and click handlers on to.
The final complexity cost was 200 lines but it was a non-linear path getting there. I went up to 500 lines before starting from scratch with a new approach.
Earlier this year I threw out an implementation after suffering with it for 2+ years. It feels like I'm getting the hang of this programming thing that I threw out an implementation after 2 days.