This commit applies the `waitForUnselectedEditor` helper function to the remaining places, that most likely predate the introduction of the helper function, to deduplicate the code and to have a unified way of checking if a given editor is unselected.