I built a prototype of something like this for the Mac OS X Cocoa text system several years ago - I called it "TextShapeView", and I was intending to make it into a Cocoa text system plugin (InputManager) so you could pop up this view next to any TextView in any program. I might have gotten further with that, but I can't remember.
Here's a blog post with details, links, and a screenshot:
The code is hosted at http://leverage.sourceforge.net/ , where there are a few other text system hacks that I did a few years ago - one of my favorites showed a hierarchical outline view next to any text view that would show the nesting of any kind of simple syntax, and let you move the selection around by selecting in the outline. It is unfinished but still pretty useful.
This is great! Thanks! I spent some time trying to learn how Cocoa's text system works and this should help quite a bit. Also, I'll try to include something like this in MacVim.
http://bigasterisk.com/projects/skim
which may give someone a starting point.