Move hiding of inline widgets into its own function,  and make inline widget hide upon change of that mark.