summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-12-04 13:11:44 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-12-04 13:11:44 +0000
commitd8f07fe001769208dc9c570849855cc46e6e42d3 (patch)
tree9a7d641c75faaf40a68e6569fdefb1e20d400411
parent358848c80fc3f352efcb58946767ab477479f732 (diff)
downloadirssi-d8f07fe001769208dc9c570849855cc46e6e42d3.zip
/SET scroll_page_count - how many lines to scroll with pgup/pgdn. either
an absolute value, or if the count starts with '/', it's calculated as lines_in_screen/count, default is /2. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@958 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/fe-text/gui-readline.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c
index e61f8c72..f9a8b2c6 100644
--- a/src/fe-text/gui-readline.c
+++ b/src/fe-text/gui-readline.c
@@ -22,6 +22,7 @@
#include "signals.h"
#include "servers.h"
#include "misc.h"
+#include "settings.h"
#include "completion.h"
#include "command-history.h"
@@ -85,18 +86,28 @@ static void handle_entry_redirect(const char *line)
window_update_prompt(active_win);
}
-static void window_prev_page(void)
+static int get_scroll_count(void)
{
- GUI_WINDOW_REC *gui = WINDOW_GUI(active_win);
+ const char *str;
+ int count;
- gui_window_scroll(active_win, -gui->parent->lines/2);
+ str = settings_get_str("scroll_page_count");
+ count = atoi(str + (*str == '/'));
+ if (count < 0) count = 1;
+
+ if (*str == '/')
+ count = WINDOW_GUI(active_win)->parent->lines/count;
+ return count;
}
-static void window_next_page(void)
+static void window_prev_page(void)
{
- GUI_WINDOW_REC *gui = WINDOW_GUI(active_win);
+ gui_window_scroll(active_win, -get_scroll_count());
+}
- gui_window_scroll(active_win, gui->parent->lines/2);
+static void window_next_page(void)
+{
+ gui_window_scroll(active_win, get_scroll_count());
}
static const char *get_key_name(int key)
@@ -541,6 +552,8 @@ void gui_readline_init(void)
idle_time = time(NULL);
readtag = g_input_add_full(0, G_PRIORITY_HIGH, G_INPUT_READ, (GInputFunction) readline, NULL);
+ settings_add_str("history", "scroll_page_count", "/2");
+
key_bind("backward_character", "", "Left", NULL, (SIGNAL_FUNC) key_backward_character);
key_bind("forward_character", "", "Right", NULL, (SIGNAL_FUNC) key_forward_character);
key_bind("backward_word", "", "Ctrl-Left", NULL, (SIGNAL_FUNC) key_backward_word);