Fix sorting of internal window list.

The sort() method needs a <0/=0/>0 comparison result. Rather than
implement that fully, use the same heuristic as for ChannelList,
via a simple index-based search.

This fixes Alt-[PAGE]{UP,DOWN} ordering issues, where the selection
seems to jump around randomly. This is most commonly seen with IRC
bouncer backends, where the "server" issues JOINs automatically.
Merge branch 'window_list_sort' into tvierling