X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTEditorWidget.java;h=823dea2d113c2d62b66e164dc06b2ce070e8cb69;hb=b1a8acec8adc13327268b1e600d367b2ba0cccc0;hp=690c5731f280a936cd1ce6f5ac3bbcf0c4d4f4ac;hpb=fe0770f988e64fc0ccafd3d3b086b4a0eb559d3b;p=nikiroo-utils.git diff --git a/src/jexer/TEditorWidget.java b/src/jexer/TEditorWidget.java index 690c573..823dea2 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; }