replace (frame-height) with (window-text-height)