git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
#18 move to event-driven main loop
[fanfix.git]
/
src
/
jexer
/
TEditorWidget.java
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;
}