Generalized TextCursor

Now it may be useful for other serialized structures as well.