Fix BR mode when caret is inside an inline element (with tests)