git://git.nikiroo.be
/
fanfix.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fe0770f
)
Mouse wheel by 3
author
Kevin Lamonte
<kevin.lamonte@gmail.com>
Tue, 15 Aug 2017 16:22:26 +0000
(12:22 -0400)
committer
Kevin Lamonte
<kevin.lamonte@gmail.com>
Tue, 15 Aug 2017 16:22:26 +0000
(12:22 -0400)
src/jexer/TEditorWidget.java
patch
|
blob
|
blame
|
history
diff --git
a/src/jexer/TEditorWidget.java
b/src/jexer/TEditorWidget.java
index 690c5731f280a936cd1ce6f5ac3bbcf0c4d4f4ac..823dea2d113c2d62b66e164dc06b2ce070e8cb69 100644
(file)
--- a/
src/jexer/TEditorWidget.java
+++ b/
src/jexer/TEditorWidget.java
@@
-45,6
+45,11
@@
import static jexer.TKeypress.*;
*/
public final class TEditorWidget extends TWidget {
*/
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.
*/
/**
* The document being edited.
*/
@@
-122,16
+127,20
@@
public final class TEditorWidget extends TWidget {
@Override
public void onMouseDown(final TMouseEvent mouse) {
if (mouse.isMouseWheelUp()) {
@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()) {
}
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;
}
}
return;
}