This can only be an infinite loop if win->nr_rows == 1. Two non-selectable rows are always separated by a selectable row.