summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Kearns <dougkearns@gmail.com>2009-06-02 16:56:59 +1000
committerDoug Kearns <dougkearns@gmail.com>2009-06-02 16:59:25 +1000
commit40ede036f67f1baeff45b081dc243f0353022990 (patch)
tree7a5be8b987d28bc5d6d4bc3a023e08511dc700e1
parent6d7b94daa6e940fd1f95ead45b9a247670d22d54 (diff)
downloadpentadactyl-40ede036f67f1baeff45b081dc243f0353022990.tar.gz
Fix <C-u> and <C-d> (durka42).
-rw-r--r--common/content/buffer.js27
1 files changed, 18 insertions, 9 deletions
diff --git a/common/content/buffer.js b/common/content/buffer.js
index e1387005..ec8a5cd6 100644
--- a/common/content/buffer.js
+++ b/common/content/buffer.js
@@ -277,14 +277,21 @@ function Buffer() //{{{
},
{ flags: Mappings.flags.COUNT });
+ function scrollByScrollSize(count, direction)
+ {
+ if (count > 0)
+ options["scroll"] = count;
+ buffer.scrollByScrollSize(direction);
+ }
+
mappings.add(myModes, ["<C-d>"],
"Scroll window downwards in the buffer",
- function (count) { buffer.scrollByScrollSize(count); },
+ function (count) { scrollByScrollSize(count, true); },
{ flags: Mappings.flags.COUNT });
mappings.add(myModes, ["<C-u>"],
"Scroll window upwards in the buffer",
- function (count) { buffer.scrollByScrollSize(-count); },
+ function (count) { scrollByScrollSize(count, false); },
{ flags: Mappings.flags.COUNT });
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
- * positive value scrolls down and a negative value up.
+ * @param {boolean} direction The direction to scroll. If true then
+ * 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)
- options["scroll"] = count;
-
+ direction = direction ? 1 : -1;
+ count = count || 1;
let win = findScrollableWindow();
+
checkScrollYBounds(win, direction);
if (options["scroll"] > 0)