1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 04:16:38 +02:00

script: fix scroll on script buffer in the detailed view of script (closes #6)

This commit is contained in:
Sebastien Helleu
2014-03-07 17:50:18 +01:00
parent 8fac1eea40
commit f62472e377
2 changed files with 44 additions and 20 deletions
+42 -20
View File
@@ -124,7 +124,7 @@ int
script_command_script (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
char *error;
char *error, command[128];
long value;
int line;
@@ -207,11 +207,9 @@ script_command_script (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
if (script_buffer && !script_buffer_detail_script
&& (script_buffer_selected_line >= 0)
&& (script_repo_count_displayed > 0))
if (weechat_strcasecmp (argv[1], "up") == 0)
{
if (weechat_strcasecmp (argv[1], "up") == 0)
if (script_buffer)
{
value = 1;
if (argc > 2)
@@ -221,17 +219,31 @@ script_command_script (void *data, struct t_gui_buffer *buffer, int argc,
if (!error || error[0])
value = 1;
}
line = script_buffer_selected_line - value;
if (line < 0)
line = 0;
if (line != script_buffer_selected_line)
if (script_buffer_detail_script)
{
script_buffer_set_current_line (line);
script_buffer_check_line_outside_window ();
snprintf (command, sizeof (command),
"/window scroll -%d", (int)value);
weechat_command (script_buffer, command);
}
else if ((script_buffer_selected_line >= 0)
&& (script_repo_count_displayed > 0))
{
line = script_buffer_selected_line - value;
if (line < 0)
line = 0;
if (line != script_buffer_selected_line)
{
script_buffer_set_current_line (line);
script_buffer_check_line_outside_window ();
}
}
return WEECHAT_RC_OK;
}
else if (weechat_strcasecmp (argv[1], "down") == 0)
return WEECHAT_RC_OK;
}
if (weechat_strcasecmp (argv[1], "down") == 0)
{
if (script_buffer)
{
value = 1;
if (argc > 2)
@@ -241,16 +253,26 @@ script_command_script (void *data, struct t_gui_buffer *buffer, int argc,
if (!error || error[0])
value = 1;
}
line = script_buffer_selected_line + value;
if (line >= script_repo_count_displayed)
line = script_repo_count_displayed - 1;
if (line != script_buffer_selected_line)
if (script_buffer_detail_script)
{
script_buffer_set_current_line (line);
script_buffer_check_line_outside_window ();
snprintf (command, sizeof (command),
"/window scroll +%d", (int)value);
weechat_command (script_buffer, command);
}
else if ((script_buffer_selected_line >= 0)
&& (script_repo_count_displayed > 0))
{
line = script_buffer_selected_line + value;
if (line >= script_repo_count_displayed)
line = script_repo_count_displayed - 1;
if (line != script_buffer_selected_line)
{
script_buffer_set_current_line (line);
script_buffer_check_line_outside_window ();
}
}
return WEECHAT_RC_OK;
}
return WEECHAT_RC_OK;
}
return WEECHAT_RC_ERROR;