1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-09 03:03:12 +02:00

Added new scroll keys for a few lines up/down (default: meta-pgup/pgdn) (patch from Pistos)

This commit is contained in:
Sebastien Helleu
2006-01-25 17:52:11 +00:00
parent 1e4c1a7073
commit 464fc8abdf
36 changed files with 2788 additions and 2400 deletions
+5
View File
@@ -73,6 +73,7 @@ char *cfg_look_charset_decode_utf;
char *cfg_look_charset_encode;
char *cfg_look_charset_internal;
int cfg_look_one_server_buffer;
int cfg_look_scroll_amount;
char *cfg_look_buffer_timestamp;
int cfg_look_color_nicks_number;
int cfg_look_color_actions;
@@ -137,6 +138,10 @@ t_config_option weechat_options_look[] =
N_("use same buffer for all servers"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
NULL, NULL, &cfg_look_one_server_buffer, NULL, config_change_one_server_buffer },
{ "look_scroll_amount", N_("how many lines to scroll by with scroll_up and scroll_down"),
N_("how many lines to scroll by with scroll_up and scroll_down"),
OPTION_TYPE_INT, 1, INT_MAX, 3,
NULL, NULL, &cfg_look_scroll_amount, NULL, config_change_buffer_content },
{ "look_buffer_timestamp", N_("timestamp for buffers"),
N_("timestamp for buffers"),
OPTION_TYPE_STRING, 0, 0, 0,
+1
View File
@@ -92,6 +92,7 @@ extern char *cfg_look_charset_decode_utf;
extern char *cfg_look_charset_encode;
extern char *cfg_look_charset_internal;
extern int cfg_look_one_server_buffer;
extern int cfg_look_scroll_amount;
extern char *cfg_look_buffer_timestamp;
extern int cfg_look_color_nicks_number;
extern int cfg_look_color_actions;
+59
View File
@@ -2711,6 +2711,65 @@ gui_window_page_down (t_gui_window *window)
}
}
/*
* gui_window_scroll_up: display previous few lines in buffer
*/
void
gui_window_scroll_up (t_gui_window *window)
{
if (!gui_ok)
return;
if (!window->first_line_displayed)
{
gui_calculate_line_diff (window, &window->start_line,
&window->start_line_pos,
(window->start_line) ?
(-1) * cfg_look_scroll_amount :
(-1) * ( (window->win_chat_height - 1) + cfg_look_scroll_amount));
gui_draw_buffer_chat (window->buffer, 0);
gui_draw_buffer_status (window->buffer, 0);
}
}
/*
* gui_window_scroll_down: display next few lines in buffer
*/
void
gui_window_scroll_down (t_gui_window *window)
{
t_gui_line *ptr_line;
int line_pos;
if (!gui_ok)
return;
if (window->start_line)
{
gui_calculate_line_diff (window, &window->start_line,
&window->start_line_pos,
cfg_look_scroll_amount);
/* check if we can display all */
ptr_line = window->start_line;
line_pos = window->start_line_pos;
gui_calculate_line_diff (window, &ptr_line,
&line_pos,
window->win_chat_height - 1);
if (!ptr_line)
{
window->start_line = NULL;
window->start_line_pos = 0;
}
gui_draw_buffer_chat (window->buffer, 0);
gui_draw_buffer_status (window->buffer, 0);
}
}
/*
* gui_window_nick_beginning: go to beginning of nicklist
*/
+2
View File
@@ -86,6 +86,8 @@ gui_input_default_key_bindings ()
gui_key_bind ( /* ^down */ "meta-Ob", "down_global");
gui_key_bind ( /* pgup */ "meta2-5~", "page_up");
gui_key_bind ( /* pgdn */ "meta2-6~", "page_down");
gui_key_bind ( /* m-pgup */ "meta-meta2-5~", "scroll_up");
gui_key_bind ( /* m-pgdn */ "meta-meta2-6~", "scroll_down");
gui_key_bind ( /* F10 */ "meta2-21~", "infobar_clear");
gui_key_bind ( /* F11 */ "meta2-23~", "nick_page_up");
gui_key_bind ( /* F12 */ "meta2-24~", "nick_page_down");
+20
View File
@@ -878,6 +878,26 @@ gui_action_page_down (t_gui_window *window)
gui_window_page_down (window);
}
/*
* gui_action_scroll_up: display previous few lines in buffer
*/
void
gui_action_scroll_up (t_gui_window *window)
{
gui_window_scroll_up (window);
}
/*
* gui_action_scroll_down: display next few lines in buffer
*/
void
gui_action_scroll_down (t_gui_window *window)
{
gui_window_scroll_down (window);
}
/*
* gui_action_nick_beginning: go to beginning of nicklist
*/
+4
View File
@@ -87,6 +87,10 @@ t_gui_key_function gui_key_functions[] =
N_("scroll one page up") },
{ "page_down", gui_action_page_down,
N_("scroll one page down") },
{ "scroll_up", gui_action_scroll_up,
N_("scroll a few lines up") },
{ "scroll_down", gui_action_scroll_down,
N_("scroll a few lines down") },
{ "nick_beginning", gui_action_nick_beginning,
N_("display beginning of nicklist") },
{ "nick_end", gui_action_nick_end,
+4
View File
@@ -459,6 +459,8 @@ extern void gui_action_down (t_gui_window *);
extern void gui_action_down_global (t_gui_window *);
extern void gui_action_page_up (t_gui_window *);
extern void gui_action_page_down (t_gui_window *);
extern void gui_action_scroll_up (t_gui_window *);
extern void gui_action_scroll_down (t_gui_window *);
extern void gui_action_nick_beginning (t_gui_window *);
extern void gui_action_nick_end (t_gui_window *);
extern void gui_action_nick_page_up (t_gui_window *);
@@ -513,6 +515,8 @@ extern void gui_switch_to_buffer (t_gui_window *, t_gui_buffer *);
extern t_gui_buffer *gui_get_dcc_buffer (t_gui_window *);
extern void gui_window_page_up (t_gui_window *);
extern void gui_window_page_down (t_gui_window *);
extern void gui_window_scroll_up (t_gui_window *);
extern void gui_window_scroll_down (t_gui_window *);
extern void gui_window_nick_beginning (t_gui_window *);
extern void gui_window_nick_end (t_gui_window *);
extern void gui_window_nick_page_up (t_gui_window *);