From b1a8acec8adc13327268b1e600d367b2ba0cccc0 Mon Sep 17 00:00:00 2001 From: Kevin Lamonte Date: Tue, 15 Aug 2017 12:22:26 -0400 Subject: [PATCH] Mouse wheel by 3 --- src/jexer/TEditorWidget.java | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/jexer/TEditorWidget.java b/src/jexer/TEditorWidget.java index 690c5731..823dea2d 100644 --- a/src/jexer/TEditorWidget.java +++ b/src/jexer/TEditorWidget.java @@ -45,6 +45,11 @@ import static jexer.TKeypress.*; */ public final class TEditorWidget extends TWidget { + /** + * The number of lines to scroll on mouse wheel up/down. + */ + private static final int wheelScrollSize = 3; + /** * The document being edited. */ @@ -122,16 +127,20 @@ public final class TEditorWidget extends TWidget { @Override public void onMouseDown(final TMouseEvent mouse) { if (mouse.isMouseWheelUp()) { - if (topLine > 0) { - topLine--; - alignDocument(false); + for (int i = 0; i < wheelScrollSize; i++) { + if (topLine > 0) { + topLine--; + alignDocument(false); + } } return; } if (mouse.isMouseWheelDown()) { - if (topLine < document.getLineCount() - 1) { - topLine++; - alignDocument(true); + for (int i = 0; i < wheelScrollSize; i++) { + if (topLine < document.getLineCount() - 1) { + topLine++; + alignDocument(true); + } } return; } -- 2.27.0