Better test for \text{} in \cases{} macro. This was for backward compatibility, but it wasn't working quite right. This should handle the situation properly by tracking the closing brace of the \text{} macro, and checking that it is at the end of the string.
Resolves issue #1482 (closed).