emulation: Fix restricted scrolling with a short ring

Fixes setting restrict scrolling with the upper bound being row 1 not working.
To test, run "echo -e '\e[1;15r'"  immediately before the terminal starts
scrolling; before this patch this had no effect.

https://bugzilla.gnome.org/show_bug.cgi?id=710483
emulation: Reset restricted scrolling on window resize

Xterm disables restricted scrolling mode on window resize. This pretty much
makes sense, since we have no clue how the application wishes to continue
restricting the scrolling (counting the number of lines from the top or from
the bottom).

https://bugzilla.gnome.org/show_bug.cgi?id=710484
emulation: Fix the scrollbar position with restricted scrolling

To reproduce, produce at least a screenful of text so that the scrollbar is
active. Then enable restricting scrolling, with the upper bound being the
topmost row, e.g. echo -e '\e[1;15r'. Now produce more output so that the
cursor hits the boundary at the 15th row and the content starts scrolling.
The scrollbar starts wandering upwards, though it should stay at the bottom.
When trying to scroll by Shift+PageUp or by dragging the scrollbar, suddenly
everything jumps back to normal.

https://bugzilla.gnome.org/show_bug.cgi?id=710488