Bug 882197: remember cursor position after calling replaceSurroundingText