To ensure right behavior you need to call `addRange` for the range which have same cursor as `editor.selection.ranges[0]` at the end. But this isn't very important issue, so you can leave it as is if you wish.