diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2009-10-06 21:25:15 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2009-10-06 21:25:15 +0200 |
commit | 5535ec5f46783d00ca2172c377c515658be569ce (patch) | |
tree | 18ece1c4f0d445803d10bcf2b486da56636fef8e | |
parent | 74fd27cc076857dbe5a98ca4d2ea9a0906c660aa (diff) | |
download | weechat-5535ec5f46783d00ca2172c377c515658be569ce.zip |
Fix alignment problem for buffer name when a merged buffer is closed (bug #27617)
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/gui/gui-buffer.c | 53 | ||||
-rw-r--r-- | src/gui/gui-line.h | 3 |
3 files changed, 41 insertions, 19 deletions
@@ -1,7 +1,7 @@ WeeChat ChangeLog ================= FlashCode <flashcode@flashtux.org> -v0.3.1-dev, 2009-10-05 +v0.3.1-dev, 2009-10-06 Version 0.3.1 (under dev!) @@ -23,6 +23,8 @@ Version 0.3.1 (under dev!) * irc: add missing CTCP: clientinfo, finger, source, time, userinfo (task #7270) * irc: improve error management on socket error (recv/send) * xfer: add missing charset decoding/encoding for IRC DCC chat (bug #27482) +* gui: fix alignment problem for buffer name when a merged buffer is closed + (bug #27617) * gui: update hotlist when a buffer is closed (bug #27470), remove buffer from hotlist when buffer is cleared (bug #27530) * gui: fix /input history_global_next: reset input content when last command in diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 1428048f3..8d76c8cd0 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -1472,7 +1472,7 @@ void gui_buffer_close (struct t_gui_buffer *buffer) { struct t_gui_window *ptr_window; - struct t_gui_buffer *ptr_buffer; + struct t_gui_buffer *ptr_buffer, *ptr_back_to_buffer; int index; struct t_gui_buffer_visited *ptr_buffer_visited; @@ -1484,9 +1484,14 @@ gui_buffer_close (struct t_gui_buffer *buffer) (void)(buffer->close_callback) (buffer->close_callback_data, buffer); } + ptr_back_to_buffer = NULL; + /* first unmerge buffer if it is merged to at least one other buffer */ if (gui_buffer_count_merged_buffers (buffer->number) > 1) + { + ptr_back_to_buffer = gui_buffer_get_next_active_buffer (buffer); gui_buffer_unmerge (buffer, -1); + } if (!weechat_quit) { @@ -1515,26 +1520,29 @@ gui_buffer_close (struct t_gui_buffer *buffer) /* switch to previous buffer */ if (gui_buffers != last_gui_buffer) { - if (ptr_buffer_visited) + if (ptr_back_to_buffer) + { + gui_window_switch_to_buffer (ptr_window, + ptr_back_to_buffer, + 1); + } + else if (ptr_buffer_visited) { gui_window_switch_to_buffer (ptr_window, ptr_buffer_visited->buffer, 1); } + else if (ptr_window->buffer->prev_buffer) + { + gui_window_switch_to_buffer (ptr_window, + ptr_window->buffer->prev_buffer, + 1); + } else { - if (ptr_window->buffer->prev_buffer) - { - gui_window_switch_to_buffer (ptr_window, - ptr_window->buffer->prev_buffer, - 1); - } - else - { - gui_window_switch_to_buffer (ptr_window, - last_gui_buffer, - 1); - } + gui_window_switch_to_buffer (ptr_window, + last_gui_buffer, + 1); } } } @@ -1891,12 +1899,14 @@ void gui_buffer_unmerge (struct t_gui_buffer *buffer, int number) { int num_merged; - struct t_gui_buffer *ptr_buffer; + struct t_gui_buffer *ptr_buffer, *ptr_new_active_buffer; /* if only one buffer then return */ if (gui_buffers == last_gui_buffer) return; + ptr_new_active_buffer = NULL; + num_merged = gui_buffer_count_merged_buffers (buffer->number); /* can't unmerge if buffer is not merged to at least one buffer */ @@ -1933,9 +1943,9 @@ gui_buffer_unmerge (struct t_gui_buffer *buffer, int number) else { /* remove this buffer from mixed_lines, but keep other buffers merged */ - ptr_buffer = gui_buffer_get_next_active_buffer (buffer); - if (ptr_buffer) - gui_buffer_set_active_buffer (ptr_buffer); + ptr_new_active_buffer = gui_buffer_get_next_active_buffer (buffer); + if (ptr_new_active_buffer) + gui_buffer_set_active_buffer (ptr_new_active_buffer); gui_line_mixed_free_buffer (buffer); buffer->mixed_lines = NULL; buffer->lines = buffer->own_lines; @@ -1986,6 +1996,13 @@ gui_buffer_unmerge (struct t_gui_buffer *buffer, int number) } gui_buffer_compute_num_displayed (); + + if (ptr_new_active_buffer) + { + gui_line_compute_prefix_max_length (ptr_new_active_buffer->mixed_lines); + gui_line_compute_buffer_max_length (ptr_new_active_buffer, + ptr_new_active_buffer->mixed_lines); + } gui_window_ask_refresh (1); diff --git a/src/gui/gui-line.h b/src/gui/gui-line.h index fe92716c8..d41c05d68 100644 --- a/src/gui/gui-line.h +++ b/src/gui/gui-line.h @@ -83,6 +83,9 @@ extern int gui_line_match_regex (struct t_gui_line *line, extern int gui_line_match_tags (struct t_gui_line *line, int tags_count, char **tags_array); extern int gui_line_has_highlight (struct t_gui_line *line); +extern void gui_line_compute_buffer_max_length (struct t_gui_buffer *buffer, + struct t_gui_lines *lines); +extern void gui_line_compute_prefix_max_length (struct t_gui_lines *lines); extern void gui_line_mixed_free_buffer (struct t_gui_buffer *buffer); extern void gui_line_mixed_free_all (struct t_gui_buffer *buffer); extern void gui_line_free (struct t_gui_buffer *buffer, |