getCaretPosition() now takes text-align into account