summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--doc/de/autogen/plugin_api/hdata.txt2
-rw-r--r--doc/en/autogen/plugin_api/hdata.txt2
-rw-r--r--doc/en/weechat_plugin_api.en.txt1
-rw-r--r--doc/fr/autogen/plugin_api/hdata.txt2
-rw-r--r--doc/fr/weechat_plugin_api.fr.txt1
-rw-r--r--doc/it/autogen/plugin_api/hdata.txt2
-rw-r--r--doc/it/weechat_plugin_api.it.txt2
-rw-r--r--src/gui/gui-buffer.c137
-rw-r--r--src/gui/gui-buffer.h9
-rw-r--r--src/gui/gui-layout.c112
-rw-r--r--src/gui/gui-layout.h8
-rw-r--r--src/plugins/irc/irc-channel.c37
-rw-r--r--src/plugins/irc/irc-server.c11
14 files changed, 217 insertions, 113 deletions
diff --git a/ChangeLog b/ChangeLog
index 473417918..5ff856193 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,14 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
-v0.3.6-dev, 2011-08-04
+v0.3.6-dev, 2011-08-05
Version 0.3.6 (under dev!)
--------------------------
+* core: fix bugs with automatic layout (bug #26110), add support of merged
+ buffers in layout (task #10893)
* core: add option -all for command /buffer unmerge
* core: fix crash when invalid UTF-8 chars are inserted in command line
(bug #33471)
diff --git a/doc/de/autogen/plugin_api/hdata.txt b/doc/de/autogen/plugin_api/hdata.txt
index d4560a5ff..fdb152b2c 100644
--- a/doc/de/autogen/plugin_api/hdata.txt
+++ b/doc/de/autogen/plugin_api/hdata.txt
@@ -225,7 +225,7 @@
'merge_for_upgrade' (pointer) +
'number' (integer) +
'layout_number' (integer) +
- 'layout_applied' (integer) +
+ 'layout_number_merge_order' (integer) +
'name' (string) +
'short_name' (string) +
'type' (integer) +
diff --git a/doc/en/autogen/plugin_api/hdata.txt b/doc/en/autogen/plugin_api/hdata.txt
index 61bd9ff35..c252dcbac 100644
--- a/doc/en/autogen/plugin_api/hdata.txt
+++ b/doc/en/autogen/plugin_api/hdata.txt
@@ -225,7 +225,7 @@
'merge_for_upgrade' (pointer) +
'number' (integer) +
'layout_number' (integer) +
- 'layout_applied' (integer) +
+ 'layout_number_merge_order' (integer) +
'name' (string) +
'short_name' (string) +
'type' (integer) +
diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt
index f51fb13a5..4c0b1f2db 100644
--- a/doc/en/weechat_plugin_api.en.txt
+++ b/doc/en/weechat_plugin_api.en.txt
@@ -8802,6 +8802,7 @@ Arguments:
* 'property': property name:
** 'number': number of buffer (starts to 1)
** 'layout_number': number of buffer saved in layout
+** 'layout_number_merge_order': order in merge for layout
** 'type': buffer type (0: formatted, 1: free content)
** 'notify': notify level for buffer
** 'num_displayed': number of windows displaying buffer
diff --git a/doc/fr/autogen/plugin_api/hdata.txt b/doc/fr/autogen/plugin_api/hdata.txt
index 0eecffe6e..92c868306 100644
--- a/doc/fr/autogen/plugin_api/hdata.txt
+++ b/doc/fr/autogen/plugin_api/hdata.txt
@@ -225,7 +225,7 @@
'merge_for_upgrade' (pointer) +
'number' (integer) +
'layout_number' (integer) +
- 'layout_applied' (integer) +
+ 'layout_number_merge_order' (integer) +
'name' (string) +
'short_name' (string) +
'type' (integer) +
diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt
index 1353725d9..48d7f336f 100644
--- a/doc/fr/weechat_plugin_api.fr.txt
+++ b/doc/fr/weechat_plugin_api.fr.txt
@@ -8943,6 +8943,7 @@ Paramètres :
* 'property' : nom de la propriété :
** 'number' : numéro du tampon (commence à 1)
** 'layout_number' : numéro du tampon sauvegardé dans le "layout"
+** 'layout_number_merge_order' : ordre du tampon mélangé pour le "layout"
** 'type' : type de tampon (0 : formaté, 1 : contenu libre)
** 'notify' : niveau de notification du tampon
** 'num_displayed' : nombre de fenêtres affichant ce tampon
diff --git a/doc/it/autogen/plugin_api/hdata.txt b/doc/it/autogen/plugin_api/hdata.txt
index c0e0446e2..dcef2f337 100644
--- a/doc/it/autogen/plugin_api/hdata.txt
+++ b/doc/it/autogen/plugin_api/hdata.txt
@@ -225,7 +225,7 @@
'merge_for_upgrade' (pointer) +
'number' (integer) +
'layout_number' (integer) +
- 'layout_applied' (integer) +
+ 'layout_number_merge_order' (integer) +
'name' (string) +
'short_name' (string) +
'type' (integer) +
diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt
index 22c3841cc..ae03a1d14 100644
--- a/doc/it/weechat_plugin_api.it.txt
+++ b/doc/it/weechat_plugin_api.it.txt
@@ -8863,6 +8863,8 @@ Argomenti:
* 'property': nome della proprietà:
** 'number': numero del buffer (inizia da 1)
** 'layout_number': numero del buffer salvato nel layout
+// TRANSLATION MISSING
+** 'layout_number_merge_order': order in merge for layout
** 'type': tipo dibuffer (0: formattato, 1: contenuto libero)
** 'notify': livello di notifica per il buffer
** 'num_displayed': numero delle finestre che visualizzano il buffer
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 766ef87f2..75cd34294 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -107,30 +107,6 @@ char *gui_buffer_properties_set[] =
/*
- * gui_buffer_find_pos: find position for buffer in list
- */
-
-struct t_gui_buffer *
-gui_buffer_find_pos (struct t_gui_buffer *buffer)
-{
- struct t_gui_buffer *ptr_buffer;
-
- /* if no number is asked by layout, then add to the end by default */
- if (buffer->layout_number < 1)
- return NULL;
-
- for (ptr_buffer = gui_buffers; ptr_buffer;
- ptr_buffer = ptr_buffer->next_buffer)
- {
- if (buffer->layout_number <= ptr_buffer->number)
- return ptr_buffer;
- }
-
- /* position not found, add to the end */
- return NULL;
-}
-
-/*
* gui_buffer_local_var_add: add a new local variable to a buffer
*/
@@ -287,11 +263,40 @@ gui_buffer_notify_set_all ()
}
/*
+ * gui_buffer_find_pos: find position for buffer in list
+ */
+
+struct t_gui_buffer *
+gui_buffer_find_pos (struct t_gui_buffer *buffer)
+{
+ struct t_gui_buffer *ptr_buffer;
+
+ /* if no number is asked by layout, then add to the end by default */
+ if (buffer->layout_number < 1)
+ return NULL;
+
+ for (ptr_buffer = gui_buffers; ptr_buffer;
+ ptr_buffer = ptr_buffer->next_buffer)
+ {
+ if ((ptr_buffer->layout_number < 1)
+ || (buffer->layout_number < ptr_buffer->layout_number)
+ || ((buffer->layout_number == ptr_buffer->layout_number)
+ && (buffer->layout_number_merge_order <= ptr_buffer->layout_number_merge_order)))
+ {
+ return ptr_buffer;
+ }
+ }
+
+ /* position not found, add to the end */
+ return NULL;
+}
+
+/*
* gui_buffer_insert: insert buffer in good position in list of buffers
*/
void
-gui_buffer_insert (struct t_gui_buffer *buffer)
+gui_buffer_insert (struct t_gui_buffer *buffer, int automatic_merge)
{
struct t_gui_buffer *pos, *ptr_buffer;
@@ -325,6 +330,21 @@ gui_buffer_insert (struct t_gui_buffer *buffer)
gui_buffers = buffer;
last_gui_buffer = buffer;
}
+
+ /* merge buffer with previous or next, if they have layout number */
+ if (automatic_merge)
+ {
+ if (buffer->prev_buffer
+ && (buffer->layout_number == (buffer->prev_buffer)->layout_number))
+ {
+ gui_buffer_merge (buffer, buffer->prev_buffer);
+ }
+ else if ((buffer->next_buffer)
+ && (buffer->layout_number == (buffer->next_buffer)->layout_number))
+ {
+ gui_buffer_merge (buffer, buffer->next_buffer);
+ }
+ }
}
/*
@@ -386,10 +406,11 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
new_buffer->merge_for_upgrade = NULL;
/* number will be set later (when inserting buffer in list) */
- new_buffer->layout_number = gui_layout_buffer_get_number (gui_layout_buffers,
- plugin_get_name (plugin),
- name);
- new_buffer->layout_applied = 0;
+ gui_layout_buffer_get_number (gui_layout_buffers,
+ plugin_get_name (plugin),
+ name,
+ &(new_buffer->layout_number),
+ &(new_buffer->layout_number_merge_order));
new_buffer->name = strdup (name);
new_buffer->short_name = strdup (name);
new_buffer->type = GUI_BUFFER_TYPE_FORMATTED;
@@ -491,7 +512,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
/* add buffer to buffers list */
first_buffer_creation = (gui_buffers == NULL);
- gui_buffer_insert (new_buffer);
+ gui_buffer_insert (new_buffer, 1);
/* set notify level */
new_buffer->notify = gui_buffer_notify_get (new_buffer);
@@ -753,6 +774,8 @@ gui_buffer_get_integer (struct t_gui_buffer *buffer, const char *property)
return buffer->number;
else if (string_strcasecmp (property, "layout_number") == 0)
return buffer->layout_number;
+ else if (string_strcasecmp (property, "layout_number_merge_order") == 0)
+ return buffer->layout_number_merge_order;
else if (string_strcasecmp (property, "type") == 0)
return buffer->type;
else if (string_strcasecmp (property, "notify") == 0)
@@ -1891,6 +1914,30 @@ gui_buffer_search_by_number (int number)
}
/*
+ * gui_buffer_search_by_layout_number: search a buffer by layout number
+ */
+
+struct t_gui_buffer *
+gui_buffer_search_by_layout_number (int layout_number,
+ int layout_number_merge_order)
+{
+ struct t_gui_buffer *ptr_buffer;
+
+ for (ptr_buffer = gui_buffers; ptr_buffer;
+ ptr_buffer = ptr_buffer->next_buffer)
+ {
+ if ((ptr_buffer->layout_number == layout_number)
+ && (ptr_buffer->layout_number_merge_order == layout_number_merge_order))
+ {
+ return ptr_buffer;
+ }
+ }
+
+ /* buffer not found */
+ return NULL;
+}
+
+/*
* gui_buffer_count_merged_buffers: return number of merged buffers (buffers
* with same number)
*/
@@ -2608,6 +2655,28 @@ gui_buffer_unmerge_all ()
}
/*
+ * gui_buffer_sort_by_layout_number: sort buffers by layout number
+ */
+
+void
+gui_buffer_sort_by_layout_number ()
+{
+ struct t_gui_buffer *ptr_buffer, *ptr_next_buffer;
+
+ ptr_buffer = gui_buffers;
+
+ gui_buffers = NULL;
+ last_gui_buffer = NULL;
+
+ while (ptr_buffer)
+ {
+ ptr_next_buffer = ptr_buffer->next_buffer;
+ gui_buffer_insert (ptr_buffer, 0);
+ ptr_buffer = ptr_next_buffer;
+ }
+}
+
+/*
* gui_buffer_undo_snap: do a "snapshot" of buffer input (save content and
* position)
*/
@@ -2985,7 +3054,7 @@ gui_buffer_hdata_buffer_cb (void *data, const char *hdata_name)
HDATA_VAR(struct t_gui_buffer, merge_for_upgrade, POINTER, NULL);
HDATA_VAR(struct t_gui_buffer, number, INTEGER, NULL);
HDATA_VAR(struct t_gui_buffer, layout_number, INTEGER, NULL);
- HDATA_VAR(struct t_gui_buffer, layout_applied, INTEGER, NULL);
+ HDATA_VAR(struct t_gui_buffer, layout_number_merge_order, INTEGER, NULL);
HDATA_VAR(struct t_gui_buffer, name, STRING, NULL);
HDATA_VAR(struct t_gui_buffer, short_name, STRING, NULL);
HDATA_VAR(struct t_gui_buffer, type, INTEGER, NULL);
@@ -3130,6 +3199,10 @@ gui_buffer_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!infolist_new_var_integer (ptr_item, "number", buffer->number))
return 0;
+ if (!infolist_new_var_integer (ptr_item, "layout_number", buffer->layout_number))
+ return 0;
+ if (!infolist_new_var_integer (ptr_item, "layout_number_merge_order", buffer->layout_number_merge_order))
+ return 0;
if (!infolist_new_var_string (ptr_item, "name", buffer->name))
return 0;
if (!infolist_new_var_string (ptr_item, "short_name", buffer->short_name))
@@ -3312,7 +3385,7 @@ gui_buffer_print_log ()
log_printf (" plugin_name_for_upgrade : '%s'", ptr_buffer->plugin_name_for_upgrade);
log_printf (" number. . . . . . . . . : %d", ptr_buffer->number);
log_printf (" layout_number . . . . . : %d", ptr_buffer->layout_number);
- log_printf (" layout_applied. . . . . : %d", ptr_buffer->layout_applied);
+ log_printf (" layout_number_merge_order: %d", ptr_buffer->layout_number_merge_order);
log_printf (" name. . . . . . . . . . : '%s'", ptr_buffer->name);
log_printf (" short_name. . . . . . . : '%s'", ptr_buffer->short_name);
log_printf (" type. . . . . . . . . . : %d", ptr_buffer->type);
diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h
index 312388aa5..97acff1c0 100644
--- a/src/gui/gui-buffer.h
+++ b/src/gui/gui-buffer.h
@@ -80,10 +80,8 @@ struct t_gui_buffer
struct t_gui_buffer *merge_for_upgrade;
int number; /* buffer number (first is 1) */
- int layout_number; /* the number of buffer saved in */
- /* layout */
- int layout_applied; /* used when applying layout, to */
- /* know if layout has been applied */
+ int layout_number; /* number of buffer saved in layout */
+ int layout_number_merge_order; /* order in merge for layout */
char *name; /* buffer name */
char *short_name; /* short buffer name */
enum t_gui_buffer_type type; /* buffer type (formatted, free, ..) */
@@ -264,6 +262,8 @@ extern struct t_gui_buffer *gui_buffer_search_by_full_name (const char *full_nam
extern struct t_gui_buffer *gui_buffer_search_by_partial_name (const char *plugin,
const char *name);
extern struct t_gui_buffer *gui_buffer_search_by_number (int number);
+extern struct t_gui_buffer *gui_buffer_search_by_layout_number (int layout_number,
+ int layout_number_merge_order);
extern int gui_buffer_count_merged_buffers (int number);
extern int gui_buffer_is_scrolled (struct t_gui_buffer *buffer);
extern void gui_buffer_clear (struct t_gui_buffer *buffer);
@@ -279,6 +279,7 @@ extern void gui_buffer_merge (struct t_gui_buffer *buffer,
struct t_gui_buffer *target_buffer);
extern void gui_buffer_unmerge (struct t_gui_buffer *buffer, int number);
extern void gui_buffer_unmerge_all ();
+extern void gui_buffer_sort_by_layout_number ();
extern void gui_buffer_undo_snap (struct t_gui_buffer *buffer);
extern void gui_buffer_undo_snap_free (struct t_gui_buffer *buffer);
extern void gui_buffer_undo_add (struct t_gui_buffer *buffer);
diff --git a/src/gui/gui-layout.c b/src/gui/gui-layout.c
index 82a41e0d9..586632063 100644
--- a/src/gui/gui-layout.c
+++ b/src/gui/gui-layout.c
@@ -178,24 +178,40 @@ gui_layout_buffer_save (struct t_gui_layout_buffer **layout_buffers,
* return 0 if not found
*/
-int
+void
gui_layout_buffer_get_number (struct t_gui_layout_buffer *layout_buffers,
- const char *plugin_name, const char *buffer_name)
+ const char *plugin_name, const char *buffer_name,
+ int *layout_number,
+ int *layout_number_merge_order)
{
struct t_gui_layout_buffer *ptr_layout_buffer;
+ int old_number, merge_order;
+
+ *layout_number = 0;
+ *layout_number_merge_order = 0;
+
+ old_number = -1;
+ merge_order = 0;
for (ptr_layout_buffer = layout_buffers; ptr_layout_buffer;
ptr_layout_buffer = ptr_layout_buffer->next_layout)
{
+ if (ptr_layout_buffer->number != old_number)
+ {
+ old_number = ptr_layout_buffer->number;
+ merge_order = 0;
+ }
+ else
+ merge_order++;
+
if ((string_strcasecmp (ptr_layout_buffer->plugin_name, plugin_name) == 0)
&& (string_strcasecmp (ptr_layout_buffer->buffer_name, buffer_name) == 0))
{
- return ptr_layout_buffer->number;
+ *layout_number = ptr_layout_buffer->number;
+ *layout_number_merge_order = merge_order;
+ return;
}
}
-
- /* plugin/buffer not found */
- return 0;
}
/*
@@ -205,58 +221,54 @@ gui_layout_buffer_get_number (struct t_gui_layout_buffer *layout_buffers,
void
gui_layout_buffer_apply (struct t_gui_layout_buffer *layout_buffers)
{
- struct t_gui_buffer *ptr_buffer;
+ struct t_gui_buffer *ptr_buffer, *ptr_next_buffer;
const char *plugin_name;
- int layout_applied_on_a_buffer;
+ int number, count_merged;
- if (layout_buffers)
+ /* compute layout number for all buffers */
+ for (ptr_buffer = gui_buffers; ptr_buffer;
+ ptr_buffer = ptr_buffer->next_buffer)
{
- /* reset flag "layout_applied" on all buffers */
- for (ptr_buffer = gui_buffers; ptr_buffer;
- ptr_buffer = ptr_buffer->next_buffer)
- {
- ptr_buffer->layout_applied = 0;
- }
+ plugin_name = plugin_get_name (ptr_buffer->plugin);
+ gui_layout_buffer_get_number (layout_buffers,
+ plugin_name,
+ ptr_buffer->name,
+ &(ptr_buffer->layout_number),
+ &(ptr_buffer->layout_number_merge_order));
+ }
+
+ /* unmerge all buffers */
+ gui_buffer_unmerge_all ();
+
+ /* sort buffers by layout number (without merge) */
+ gui_buffer_sort_by_layout_number ();
+
+ /* merge buffers */
+ ptr_buffer = gui_buffers->next_buffer;
+ while (ptr_buffer)
+ {
+ ptr_next_buffer = ptr_buffer->next_buffer;
- /*
- * apply layout on all buffers: we start from first buffer each time,
- * until layout has been applied on all buffers
- */
- while (1)
+ if (ptr_buffer->layout_number == (ptr_buffer->prev_buffer)->layout_number)
+ gui_buffer_merge (ptr_buffer, ptr_buffer->prev_buffer);
+
+ ptr_buffer = ptr_next_buffer;
+ }
+
+ /* set appropriate active buffers */
+ number = 1;
+ while (number <= last_gui_buffer->number)
+ {
+ count_merged = gui_buffer_count_merged_buffers (number);
+ if (count_merged > 1)
{
- layout_applied_on_a_buffer = 0;
- for (ptr_buffer = gui_buffers; ptr_buffer;
- ptr_buffer = ptr_buffer->next_buffer)
+ ptr_buffer = gui_buffer_search_by_layout_number (number, 0);
+ if (ptr_buffer && !ptr_buffer->active)
{
- /* if layout has not been applied on buffer yet */
- if (!ptr_buffer->layout_applied)
- {
- ptr_buffer->layout_applied = 1;
- layout_applied_on_a_buffer = 1;
- plugin_name = plugin_get_name (ptr_buffer->plugin);
- ptr_buffer->layout_number = gui_layout_buffer_get_number (layout_buffers,
- plugin_name,
- ptr_buffer->name);
- if ((ptr_buffer->layout_number > 0)
- && (ptr_buffer->layout_number != ptr_buffer->number))
- {
- gui_buffer_move_to_number (ptr_buffer,
- ptr_buffer->layout_number);
- }
- /*
- * exit loop when layout has been applied on buffer, we
- * will apply for next buffers in another loop
- */
- break;
- }
+ gui_buffer_set_active_buffer (ptr_buffer);
}
- /*
- * no layout applied: that means layout has been applied on all
- * buffers, so we exit from loop
- */
- if (!layout_applied_on_a_buffer)
- break;
}
+ number++;
}
}
diff --git a/src/gui/gui-layout.h b/src/gui/gui-layout.h
index db2a574bb..0b094f6a1 100644
--- a/src/gui/gui-layout.h
+++ b/src/gui/gui-layout.h
@@ -67,9 +67,11 @@ extern struct t_gui_layout_buffer *gui_layout_buffer_add (struct t_gui_layout_bu
int number);
extern void gui_layout_buffer_save (struct t_gui_layout_buffer **layout_buffers,
struct t_gui_layout_buffer **last_layout_buffer);
-extern int gui_layout_buffer_get_number (struct t_gui_layout_buffer *layout_buffers,
- const char *plugin_name,
- const char *buffer_name);
+extern void gui_layout_buffer_get_number (struct t_gui_layout_buffer *layout_buffers,
+ const char *plugin_name,
+ const char *buffer_name,
+ int *layout_number,
+ int *layout_number_merge_order);
extern void gui_layout_buffer_apply (struct t_gui_layout_buffer *layout_buffers);
extern void gui_layout_window_remove_all (struct t_gui_layout_window **layout_windows);
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index b31508312..e58847283 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -182,24 +182,27 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
free (new_channel);
return NULL;
}
- buffer_position = (channel_type == IRC_CHANNEL_TYPE_CHANNEL) ?
- weechat_config_integer (irc_config_look_new_channel_position) :
- weechat_config_integer (irc_config_look_new_pv_position);
- switch (buffer_position)
+ if (weechat_buffer_get_integer (new_buffer, "layout_number") < 1)
{
- case IRC_CONFIG_LOOK_BUFFER_POSITION_NONE:
- /* do nothing */
- break;
- case IRC_CONFIG_LOOK_BUFFER_POSITION_NEXT:
- /* move buffer to current number + 1 */
- snprintf (str_number, sizeof (str_number),
- "%d", current_buffer_number + 1);
- weechat_buffer_set (new_buffer, "number", str_number);
- break;
- case IRC_CONFIG_LOOK_BUFFER_POSITION_NEAR_SERVER:
- /* move buffer after last channel/pv of server */
- irc_channel_move_near_server (server, channel_type, new_buffer);
- break;
+ buffer_position = (channel_type == IRC_CHANNEL_TYPE_CHANNEL) ?
+ weechat_config_integer (irc_config_look_new_channel_position) :
+ weechat_config_integer (irc_config_look_new_pv_position);
+ switch (buffer_position)
+ {
+ case IRC_CONFIG_LOOK_BUFFER_POSITION_NONE:
+ /* do nothing */
+ break;
+ case IRC_CONFIG_LOOK_BUFFER_POSITION_NEXT:
+ /* move buffer to current number + 1 */
+ snprintf (str_number, sizeof (str_number),
+ "%d", current_buffer_number + 1);
+ weechat_buffer_set (new_buffer, "number", str_number);
+ break;
+ case IRC_CONFIG_LOOK_BUFFER_POSITION_NEAR_SERVER:
+ /* move buffer after last channel/pv of server */
+ irc_channel_move_near_server (server, channel_type, new_buffer);
+ break;
+ }
}
buffer_created = 1;
}
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 2e26cc4cb..cf8aff758 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -2865,9 +2865,16 @@ irc_server_create_buffer (struct t_irc_server *server)
irc_server_set_buffer_title (server);
- /* merge buffer if needed */
- if (ptr_buffer_for_merge)
+ /*
+ * merge buffer if needed: if merge with(out) core set, and if no layout
+ * number is assigned for this buffer (if layout number is assigned, then
+ * buffer was already moved/merged by WeeChat core)
+ */
+ if (ptr_buffer_for_merge
+ && (weechat_buffer_get_integer (server->buffer, "layout_number") < 1))
+ {
weechat_buffer_merge (server->buffer, ptr_buffer_for_merge);
+ }
return server->buffer;
}