1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

/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
This commit is contained in:
Timo Sirainen 2000-12-04 13:11:44 +00:00 committed by cras
parent 358848c80f
commit d8f07fe001

View File

@ -22,6 +22,7 @@
#include "signals.h" #include "signals.h"
#include "servers.h" #include "servers.h"
#include "misc.h" #include "misc.h"
#include "settings.h"
#include "completion.h" #include "completion.h"
#include "command-history.h" #include "command-history.h"
@ -85,18 +86,28 @@ static void handle_entry_redirect(const char *line)
window_update_prompt(active_win); window_update_prompt(active_win);
} }
static int get_scroll_count(void)
{
const char *str;
int count;
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_prev_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) static void window_next_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 const char *get_key_name(int key) static const char *get_key_name(int key)
@ -541,6 +552,8 @@ void gui_readline_init(void)
idle_time = time(NULL); idle_time = time(NULL);
readtag = g_input_add_full(0, G_PRIORITY_HIGH, G_INPUT_READ, (GInputFunction) readline, 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("backward_character", "", "Left", NULL, (SIGNAL_FUNC) key_backward_character);
key_bind("forward_character", "", "Right", NULL, (SIGNAL_FUNC) key_forward_character); key_bind("forward_character", "", "Right", NULL, (SIGNAL_FUNC) key_forward_character);
key_bind("backward_word", "", "Ctrl-Left", NULL, (SIGNAL_FUNC) key_backward_word); key_bind("backward_word", "", "Ctrl-Left", NULL, (SIGNAL_FUNC) key_backward_word);