From 900eb1d0b0a6a4460c79170ee7dcc006d5d878dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20N=C4=9Bmec?= Date: Mon, 14 Nov 2011 13:32:15 +0100 Subject: [PATCH] Revert the d4c21ee2e4a4 change. The behaviour turns out to be Vim-compatible. --- common/modules/buffer.jsm | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/common/modules/buffer.jsm b/common/modules/buffer.jsm index 2422958d..94408494 100644 --- a/common/modules/buffer.jsm +++ b/common/modules/buffer.jsm @@ -679,23 +679,29 @@ var Buffer = Module("Buffer", { scrollToPosition: function scrollToPosition(horizontal, vertical) Buffer.scrollToPosition(this.findScrollable(0, vertical == null), horizontal, vertical), + _scrollByScrollSize: function _scrollByScrollSize(count, direction) { + let { options } = this.modules; + + if (count > 0) + options["scroll"] = count; + this.scrollByScrollSize(direction); + }, + /** - * Scrolls the buffer vertically 'scroll' or *count* lines. + * Scrolls the buffer vertically 'scroll' lines. * - * @param {number} count The number of lines to scroll. When 0, use the - * 'scroll' option value. * @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 scrollByScrollSize(count, direction) { + scrollByScrollSize: function scrollByScrollSize(direction, count) { let { options } = this.modules; direction = direction ? 1 : -1; + count = count || 1; - if (count > 0) - this.scrollVertical("lines", count * direction); - else if (options["scroll"] > 0) + if (options["scroll"] > 0) this.scrollVertical("lines", options["scroll"] * direction); else this.scrollVertical("pages", direction / 2); @@ -1931,12 +1937,12 @@ var Buffer = Module("Buffer", { mappings.add([modes.NORMAL], ["", ""], "Scroll window downwards in the buffer", - function (args) { buffer.scrollByScrollSize(args.count, true); }, + function (args) { buffer._scrollByScrollSize(args.count, true); }, { count: true }); mappings.add([modes.NORMAL], ["", ""], "Scroll window upwards in the buffer", - function (args) { buffer.scrollByScrollSize(args.count, false); }, + function (args) { buffer._scrollByScrollSize(args.count, false); }, { count: true }); mappings.add([modes.NORMAL], ["", "", "", ""],