Created
February 26, 2009 04:04
-
-
Save snaka/70647 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buffer.js | |
--- | |
/** | |
* Scrolls the buffer vertically <b>pages</b> pages. | |
* | |
* @param {number} pages The number of pages to scroll. | |
*/ | |
scrollPages: function (pages) | |
{ | |
let win = findScrollableWindow(); | |
checkScrollYBounds(win, pages); | |
win.scrollByPages(pages); | |
}, | |
/** | |
* Scrolls the buffer vertically <b>count</b> * 'scroll' rows. | |
* | |
* @param {number} count The multiple of 'scroll' lines to scroll. | |
* @param {number} direction The direction to scroll, down if 1 and up if -1. | |
*/ | |
scrollByScrollSize: function (count, direction) // XXX: boolean | |
{ | |
if (count > 0) | |
options["scroll"] = count; | |
let win = findScrollableWindow(); | |
checkScrollYBounds(win, direction); | |
if (options["scroll"] > 0) | |
this.scrollLines(options["scroll"] * direction); | |
else // scroll half a page down in pixels | |
win.scrollBy(0, win.innerHeight / 2 * direction); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment