Ensure the cursor is in a walkable state after applying direct styling

Due to how text splitting works, the cursor is often left outside the
span, resulting in:
```
<p>|A|<span>B</span>|C|</p>
```

According to README_cursorpositions.txt, the cursor position near a span
is after the last character in the span. I.e.,:
```
<p>|A|<span>B|</span>C|</p>
```

The fix for this is to fix the cursor positions after the operation has
been executed