From 87a0c061979f1475cb0e6b2489835c4a3e9fdd6c Mon Sep 17 00:00:00 2001 From: Camille Scholtz Date: Tue, 17 May 2016 18:15:47 +0200 Subject: [PATCH] Add scrollspeed option --- cmd/micro/settings.go | 1 + cmd/micro/view.go | 10 ++++++---- runtime/help/help.md | 4 ++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cmd/micro/settings.go b/cmd/micro/settings.go index 01aa72ef..db7d5b11 100644 --- a/cmd/micro/settings.go +++ b/cmd/micro/settings.go @@ -79,6 +79,7 @@ func DefaultSettings() map[string]interface{} { "tabsToSpaces": false, "ruler": true, "statusline": true, + "scrollSpeed": float64(2), } } diff --git a/cmd/micro/view.go b/cmd/micro/view.go index f44ee174..cd6353d1 100644 --- a/cmd/micro/view.go +++ b/cmd/micro/view.go @@ -366,13 +366,15 @@ func (v *View) HandleEvent(event tcell.Event) { // every time the user moves the cursor relocate = false case tcell.WheelUp: - // Scroll up two lines - v.ScrollUp(2) + // Scroll up + scrollSpeed := int(settings["scrollspeed"].(float64)) + v.ScrollUp(scrollSpeed) // We don't want to relocate if the user is scrolling relocate = false case tcell.WheelDown: - // Scroll down two lines - v.ScrollDown(2) + // Scroll down + scrollSpeed := int(settings["scrollspeed"].(float64)) + v.ScrollDown(scrollSpeed) // We don't want to relocate if the user is scrolling relocate = false } diff --git a/runtime/help/help.md b/runtime/help/help.md index f18a5461..b27be80f 100644 --- a/runtime/help/help.md +++ b/runtime/help/help.md @@ -199,6 +199,10 @@ Here are the options that you can set: default value: `on` +* `scrollspeed`: amount of lines to scroll + + default value: `2` + --- Default plugin options: