summaryrefslogtreecommitdiff
path: root/src/gui/gui-layout.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2013-11-30 10:39:38 +0100
committerSebastien Helleu <flashcode@flashtux.org>2013-11-30 10:39:38 +0100
commita496db78aa0972990fc4fb012f807314796f21e7 (patch)
treed7634742bda44e04167b98da6e4a7f3b91753873 /src/gui/gui-layout.c
parent9cc31d88ea989e18ef2cd3ee9b11b242cc134f37 (diff)
downloadweechat-a496db78aa0972990fc4fb012f807314796f21e7.zip
core: add option weechat.look.buffer_auto_renumber
New option: weechat.look.buffer_auto_renumber, boolean which is on by default, so the behavior is the same: no gap is allowed in numbers, they start at number 1 and they are auto-renumbered after each command like /buffer move, /buffer merge, ... A new option "renumber" has been added in command /buffer, to renumber a range of buffers (or all). Changes when the option weechat.look.buffer_auto_renumber is off: - command "/buffer move": - the current number will be left free for use, and the target number can be any number >= 1 (possibly higher than the current last buffer number) - the value can be "-" (which moves the buffer to number 1) or "+" (which moves the buffer to the end, ie last number + 1) - command "/buffer swap": - now the buffers are swapped in the list without being "moved" - comand "/buffer [+/-]N": - it is now working with gaps in buffer numbers - command "/buffer merge": - it can now merge a group of merged buffers into another buffer (or buffers merged themselves) - layout can restore buffer numbers with gaps in numbers
Diffstat (limited to 'src/gui/gui-layout.c')
-rw-r--r--src/gui/gui-layout.c34
1 files changed, 7 insertions, 27 deletions
diff --git a/src/gui/gui-layout.c b/src/gui/gui-layout.c
index 42a143bf0..672af41e7 100644
--- a/src/gui/gui-layout.c
+++ b/src/gui/gui-layout.c
@@ -342,8 +342,7 @@ gui_layout_buffer_save (struct t_gui_layout *layout)
void
gui_layout_buffer_apply (struct t_gui_layout *layout)
{
- struct t_gui_buffer *ptr_buffer, *ptr_next_buffer;
- int number, count_merged;
+ struct t_gui_buffer *ptr_buffer;
if (!layout)
return;
@@ -357,35 +356,16 @@ gui_layout_buffer_apply (struct t_gui_layout *layout)
/* 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;
-
- if ((ptr_buffer->layout_number >= 1)
- && (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)
+ for (ptr_buffer = gui_buffers; ptr_buffer;
+ ptr_buffer = ptr_buffer->next_buffer)
{
- count_merged = gui_buffer_count_merged_buffers (number);
- if (count_merged > 1)
+ if ((gui_buffer_count_merged_buffers (ptr_buffer->number) > 1)
+ && (ptr_buffer->layout_number == ptr_buffer->number)
+ && (ptr_buffer->layout_number_merge_order == 0))
{
- ptr_buffer = gui_buffer_search_by_layout_number (number, 0);
- if (ptr_buffer && !ptr_buffer->active)
- {
- gui_buffer_set_active_buffer (ptr_buffer);
- }
+ gui_buffer_set_active_buffer (ptr_buffer);
}
- number++;
}
}