Use selection priority in double-click selection logic. Fixes #4053.