Update the query text whenever the dropdown folds.

Currently, if after the user changes the query text, the original select
still matches the query; and if the user chooses the same selection, the
query text will not be overwritten.