# HG changeset patch # User Atul Varma # Date 1211439614 25200 # Node ID f8d853a77c528191d30cc6b79a3d3522fdcb2b14 # Parent e48403e2a3b53c768b10717ecac80e947c0a9e7a The window no longer auto-scrolls all the way to the bottom of the page unconditionally; if text has been displayed that the user needs to read, the viewport is only scrolled to the last point that we know the user has read up to, which is the last point that we took input from the user. diff -r e48403e2a3b5 -r f8d853a77c52 web-zui.js --- a/web-zui.js Wed May 21 22:00:48 2008 -0700 +++ b/web-zui.js Thu May 22 00:00:14 2008 -0700 @@ -10,6 +10,7 @@ this._foreground = "default"; this._background = "default"; this._reverseVideo = false; + this._lastSeenY = 0; this._currStyles = ["z-roman"]; if (logfunc) { @@ -28,7 +29,7 @@ }, _scrollBottomWindow: function() { - window.scroll(0, document.body.scrollHeight); + window.scroll(0, self._lastSeenY); }, _finalize: function() { @@ -109,6 +110,10 @@ self._currentCallback = null; self._removeBufferedWindows(); + + // TODO: This may not be the most accurate calculation. + self._lastSeenY = document.height; + callback(keyCode); } } @@ -137,6 +142,7 @@ self._inputString = ""; self._currentCallback = null; finalInputString = finalInputString.entityify(); + self._lastSeenY = $("#current-input").get(0).offsetTop; $("#current-input").replaceWith( ('' + finalInputString + '
') @@ -169,6 +175,7 @@ _eraseBottomWindow: function() { $("#content").empty(); + this._lastSeenY = 0; }, setVersion: function(version) {