make sure toc height is never greater than height of the window, closes #14