Initial work to get complex text input working. Doesn't quite work yet.