WIP: more spaghetti code to handle style spans on selection changed