rangeHasMark assumes that from < to, and is only used by the core commands in situations where that is the case. It seems that it isn’t very reliable when they are the same. You may be looking for something like schema.marks.link.isInSet(state.storedMarks || $cursor.marks()), since for cursor selections you want probably to take the stored marks into account as well.