Text you can actually select

You might be able to extend DirectEntry–at least then you have the fundaments on which to build. Through binding various events you could intercept the relevant key-strokes and update the entry as appropriate.

(Also, have you searched the forum for a similar project? It’s not impossible that someone has had a similar idea at some point in the past.

In fact, here’s a thread offering something that looks like it may do what you want:

I haven’t used it myself, so I’m not in a position to recommend for or against it, but it might be worth looking into.)