summaryrefslogtreecommitdiff
path: root/src/plugins/script
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2012-12-21 21:59:05 +0100
committerSebastien Helleu <flashcode@flashtux.org>2012-12-21 21:59:05 +0100
commitc08cacd3c00d6524a5aaa2ffcab3ca57284c3adf (patch)
treec0530d76236fbec1d32b7907a071796fd2705513 /src/plugins/script
parent992ed5b75ccc69b3ec7ebdedac2768c92560c97e (diff)
downloadweechat-c08cacd3c00d6524a5aaa2ffcab3ca57284c3adf.zip
script: do not open script buffer when unknown arguments are given to command /script
Diffstat (limited to 'src/plugins/script')
-rw-r--r--src/plugins/script/script-command.c85
1 files changed, 37 insertions, 48 deletions
diff --git a/src/plugins/script/script-command.c b/src/plugins/script/script-command.c
index b785969a1..3c72e1e7e 100644
--- a/src/plugins/script/script-command.c
+++ b/src/plugins/script/script-command.c
@@ -204,63 +204,52 @@ script_command_script (void *data, struct t_gui_buffer *buffer, int argc,
return WEECHAT_RC_OK;
}
- if (!script_buffer)
- script_buffer_open ();
-
- if (script_buffer)
+ if ((argc > 1) && script_buffer && !script_buffer_detail_script
+ && (script_buffer_selected_line >= 0)
+ && (script_repo_count_displayed > 0))
{
- if (argc > 1)
+ if (weechat_strcasecmp (argv[1], "up") == 0)
{
- if (!script_buffer_detail_script
- && (script_buffer_selected_line >= 0)
- && (script_repo_count_displayed > 0))
+ value = 1;
+ if (argc > 2)
{
- if (strcmp (argv[1], "up") == 0)
- {
+ error = NULL;
+ value = strtol (argv[2], &error, 10);
+ if (!error || error[0])
value = 1;
- if (argc > 2)
- {
- error = NULL;
- value = strtol (argv[2], &error, 10);
- if (!error || error[0])
- value = 1;
- }
- 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 (strcmp (argv[1], "down") == 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)
+ {
+ value = 1;
+ if (argc > 2)
+ {
+ error = NULL;
+ value = strtol (argv[2], &error, 10);
+ if (!error || error[0])
value = 1;
- if (argc > 2)
- {
- error = NULL;
- value = strtol (argv[2], &error, 10);
- 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)
- {
- script_buffer_set_current_line (line);
- script_buffer_check_line_outside_window ();
- }
- return WEECHAT_RC_OK;
- }
}
+ 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;
}
}
- script_buffer_refresh (0);
-
return WEECHAT_RC_OK;
}