diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index e23483cfd..c7aeb3657 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -70,6 +70,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * relay: fix freeze after /upgrade when many disconnected clients still exist * relay: fix NULL pointer when reading buffer lines for irc backlog * rmodifier: remove plugin (replaced by trigger) +* script: fix scroll on script buffer in the detailed view of script + (closes #6) * scripts: fix crash when a signal is received with type "int" and NULL pointer in signal_data * trigger: add trigger plugin: new command /trigger and file trigger.conf diff --git a/src/plugins/script/script-command.c b/src/plugins/script/script-command.c index efc397672..6cc8edbf2 100644 --- a/src/plugins/script/script-command.c +++ b/src/plugins/script/script-command.c @@ -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;