1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 21:28:00 +01:00

Fix <C-u> and <C-d> (durka42).

This commit is contained in:
Doug Kearns
2009-06-02 16:56:59 +10:00
parent 6d7b94daa6
commit 40ede036f6

View File

@@ -277,14 +277,21 @@ function Buffer() //{{{
}, },
{ flags: Mappings.flags.COUNT }); { flags: Mappings.flags.COUNT });
function scrollByScrollSize(count, direction)
{
if (count > 0)
options["scroll"] = count;
buffer.scrollByScrollSize(direction);
}
mappings.add(myModes, ["<C-d>"], mappings.add(myModes, ["<C-d>"],
"Scroll window downwards in the buffer", "Scroll window downwards in the buffer",
function (count) { buffer.scrollByScrollSize(count); }, function (count) { scrollByScrollSize(count, true); },
{ flags: Mappings.flags.COUNT }); { flags: Mappings.flags.COUNT });
mappings.add(myModes, ["<C-u>"], mappings.add(myModes, ["<C-u>"],
"Scroll window upwards in the buffer", "Scroll window upwards in the buffer",
function (count) { buffer.scrollByScrollSize(-count); }, function (count) { scrollByScrollSize(count, false); },
{ flags: Mappings.flags.COUNT }); { flags: Mappings.flags.COUNT });
mappings.add(myModes, ["<C-b>", "<PageUp>", "<S-Space>"], mappings.add(myModes, ["<C-b>", "<PageUp>", "<S-Space>"],
@@ -1307,17 +1314,19 @@ function Buffer() //{{{
}, },
/** /**
* Scrolls the buffer vertically <b>count</b> * 'scroll' rows. * Scrolls the buffer vertically 'scroll' lines.
* *
* @param {number} count The multiple of 'scroll' lines to scroll. A * @param {boolean} direction The direction to scroll. If true then
* positive value scrolls down and a negative value up. * scroll up and if false scroll down.
* @param {number} count The multiple of 'scroll' lines to scroll.
* @optional
*/ */
scrollByScrollSize: function (count) scrollByScrollSize: function (direction, count)
{ {
if (count > 0) direction = direction ? 1 : -1;
options["scroll"] = count; count = count || 1;
let win = findScrollableWindow(); let win = findScrollableWindow();
checkScrollYBounds(win, direction); checkScrollYBounds(win, direction);
if (options["scroll"] > 0) if (options["scroll"] > 0)