take window size into account before restricting the limit.
Merge branch 'master' into dev