aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-05-04 18:46:28 -0400
committerJesse Luehrs <doy@tozt.net>2014-05-04 18:46:28 -0400
commitc48544e613903c617c1318b1f1cc4d7eae9daa47 (patch)
treed8051bbe946d7f611b43e9c8866b22ab1b225d50
parent3c4d1c9d43c80abf5a938d1f5416e7a9d4f339dd (diff)
downloadrunes-c48544e613903c617c1318b1f1cc4d7eae9daa47.tar.gz
runes-c48544e613903c617c1318b1f1cc4d7eae9daa47.zip
allow the number of lines to scroll at a time to be configurable
-rw-r--r--src/config.c5
-rw-r--r--src/config.h2
-rw-r--r--src/window-xlib.c18
3 files changed, 17 insertions, 8 deletions
diff --git a/src/config.c b/src/config.c
index 1179a3d..3a4ae4a 100644
--- a/src/config.c
+++ b/src/config.c
@@ -310,6 +310,8 @@ static void runes_config_set_defaults(RunesTerm *t)
config->default_rows = 24;
config->default_cols = 80;
+
+ config->scroll_lines = 3;
}
static FILE *runes_config_get_config_file()
@@ -494,6 +496,9 @@ static void runes_config_set(RunesTerm *t, char *key, char *val)
else if (!strcmp(key, "cols")) {
config->default_cols = runes_config_parse_uint(val);
}
+ else if (!strcmp(key, "scroll_lines")) {
+ config->scroll_lines = runes_config_parse_uint(val);
+ }
else if (!strcmp(key, "command")) {
config->cmd = runes_config_parse_string(val);
}
diff --git a/src/config.h b/src/config.h
index c22f32e..a98d9d0 100644
--- a/src/config.h
+++ b/src/config.h
@@ -12,6 +12,8 @@ struct runes_config {
int default_rows;
int default_cols;
+ int scroll_lines;
+
char *cmd;
char *font_name;
diff --git a/src/window-xlib.c b/src/window-xlib.c
index d792cfc..96d2558 100644
--- a/src/window-xlib.c
+++ b/src/window-xlib.c
@@ -759,18 +759,20 @@ static int runes_window_backend_handle_builtin_button_press(
return 1;
break;
case Button4:
- if (t->scr.row_visible_offset < t->scr.row_count - t->scr.max.row) {
- t->scr.row_visible_offset++;
- t->scr.dirty = 1;
- runes_window_backend_flush(t);
+ t->scr.row_visible_offset += t->config.scroll_lines;
+ if (t->scr.row_visible_offset > t->scr.row_count - t->scr.max.row) {
+ t->scr.row_visible_offset = t->scr.row_count - t->scr.max.row;
}
+ t->scr.dirty = 1;
+ runes_window_backend_flush(t);
break;
case Button5:
- if (t->scr.row_visible_offset > 0) {
- t->scr.row_visible_offset--;
- t->scr.dirty = 1;
- runes_window_backend_flush(t);
+ t->scr.row_visible_offset -= t->config.scroll_lines;
+ if (t->scr.row_visible_offset < 0) {
+ t->scr.row_visible_offset = 0;
}
+ t->scr.dirty = 1;
+ runes_window_backend_flush(t);
break;
default:
break;