Engine: Unify line splitting

Changed the order of operations for reversing text and modified the line
splitting code to use the same function for left-to-right and
right-to-left.
Engine: Unescape \[ before calculating wrapped text width

Replaced the removeBackslashBracket with a new unescape function that
handles both [ and \[. Modified the split_lines algorithm so that text
is unescaped before its width is calculated.