Rework findFirstCaretContext()