Scroll region bug fix

Hi Dmitry!

Here is a patch to fix a bug when the requested scroll region is larger than term size.
It has been tested and validated.

I have included the test file.