summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2014-04-05 11:49:06 +0200
committerSébastien Helleu <flashcode@flashtux.org>2014-04-05 11:49:06 +0200
commita44a1eab199c6174a7bb6d935034ea6fb946f6c3 (patch)
treeee7160f7ae92706eea61c2a762956dd1c1d3e213
parent698d6a3631b4f0d8dd65c05fe5361c55df1d469a (diff)
downloadweechat-a44a1eab199c6174a7bb6d935034ea6fb946f6c3.zip
core: fix "/buffer clear" with a name (don't clear all merged buffers with same number)
-rw-r--r--ChangeLog.asciidoc2
-rw-r--r--src/core/wee-command.c33
2 files changed, 27 insertions, 8 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc
index 490285b6e..b1a8410cf 100644
--- a/ChangeLog.asciidoc
+++ b/ChangeLog.asciidoc
@@ -15,6 +15,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
== Version 0.4.4 (under dev)
+* core: fix "/buffer clear" with a name (don't clear all merged buffers with
+ same number)
* core: fix evaluation of expression with regex when a comparison char is in
the regex
* core: close .upgrade files before deleting them after /upgrade
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index cde611957..20edfbc3b 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -546,7 +546,7 @@ COMMAND_CALLBACK(buffer)
struct t_gui_buffer *weechat_buffer;
long number, number1, number2, numbers[3];
char *error, *value, *pos, *str_number1, *pos_number2;
- int i, error_main_buffer, num_buffers, count, prev_number;
+ int i, error_main_buffer, num_buffers, count, prev_number, clear_number;
/* make C compiler happy */
(void) data;
@@ -590,19 +590,36 @@ COMMAND_CALLBACK(buffer)
{
for (i = 2; i < argc; i++)
{
- ptr_buffer = (string_strcasecmp (argv[i], "-merged") == 0) ?
- buffer : gui_buffer_search_by_number_or_name (argv[i]);
+ if (string_strcasecmp (argv[i], "-merged") == 0)
+ {
+ ptr_buffer = buffer;
+ clear_number = 1;
+ }
+ else
+ {
+ ptr_buffer = gui_buffer_search_by_number_or_name (argv[i]);
+ number = strtol (argv[2], &error, 10);
+ clear_number = (error && !error[0]);
+ }
if (ptr_buffer)
{
- for (ptr_buffer2 = gui_buffers; ptr_buffer2;
- ptr_buffer2 = ptr_buffer2->next_buffer)
+ if (clear_number)
{
- if ((ptr_buffer2->number == ptr_buffer->number)
- && ptr_buffer2->clear)
+ for (ptr_buffer2 = gui_buffers; ptr_buffer2;
+ ptr_buffer2 = ptr_buffer2->next_buffer)
{
- gui_buffer_clear (ptr_buffer2);
+ if ((ptr_buffer2->number == ptr_buffer->number)
+ && ptr_buffer2->clear)
+ {
+ gui_buffer_clear (ptr_buffer2);
+ }
}
}
+ else
+ {
+ if (ptr_buffer->clear)
+ gui_buffer_clear (ptr_buffer);
+ }
}
}
}