Fix run determination when inserting text