Fixed caret-position bug with right-aligned text.