Optimize coordsOfCharacterB.
Fix cursor position in minibuffer.