netguy204/imp.el — pull request #10 by brool (2013-10-22 05:45:57+00:00)
Title: Minor tweaks

On Chrome / Firefox on Mac OS X, impatient-mode was always scrolling down on any change to the buffer. offY was always getting set to null in index.html line 58, and then on line 63 was forced to scroll down one window.

I think what's going on here is that doc.body.clientHeight is not quite the right measure to use -- the client height is the size of the window (not the size of the document), and it is always the same as $(iwindow).height().

I believe what's intended instead is $(doc.body).height() ($(doc).height() would probably work too) to represent the size of the content inside the window, not the size of the client window itself.

I've tested this fix on Firefox / Chrome for Mac OS X for the following cases: a) changing text at the beginning of a file (the browser window does not scroll down incorrectly), b) changing text in the middle of the document, c) changing a few characters at the end of a document, and d) being at the end of a document and appending a large amount of content (correctly scrolls down to the end).