Fixed an obscure bug affecting where the window end was allowed to be,
along with a couple of other things relating to selecting subtree roots.