core: fix display problem when option weechat.look.prefix_same_nick is set (problem with nick displayed in first line of screen) (bug #37556)

To fix this bug, a feature has been removed: the first message with a nick has
the prefix forced (to not display the value of weechat.look.prefix_same_nick on
top of screen), commit was: 04e98c3f29156a04785f86d429dda4d521fc1779
This feature may be reintroduced in a future commit.
This commit is contained in:
Sebastien Helleu 2012-10-17 16:34:21 +02:00
parent d403d7b79b
commit f42b3d382f
6 changed files with 10 additions and 44 deletions

View File

@ -1,12 +1,14 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.4.0-dev, 2012-10-16
v0.4.0-dev, 2012-10-17
Version 0.4.0 (under dev!)
--------------------------
* core: fix display problem when option weechat.look.prefix_same_nick is set
(problem with nick displayed in first line of screen) (bug #37556)
* core: fix wrapping of words with wide chars (the break was made before the
correct position)
* api: connect with IPv6 by default in hook_connect (with fallback to IPv4),

View File

@ -458,8 +458,7 @@ gui_chat_display_word (struct t_gui_window *window,
while (ptr_data && ptr_data[0])
{
/* insert spaces for aligning text under time/nick */
length_align = gui_line_get_align (window->buffer, line, 0, 0,
GUI_WINDOW_OBJECTS(window)->force_prefix_for_line);
length_align = gui_line_get_align (window->buffer, line, 0, 0);
if ((window->win_chat_cursor_x == 0)
&& (*lines_displayed > 0)
/* FIXME: modify arbitraty value for non aligning messages on time/nick? */
@ -771,17 +770,8 @@ gui_chat_display_time_to_prefix (struct t_gui_window *window,
}
/* get prefix for display */
if (GUI_WINDOW_OBJECTS(window)->force_prefix_for_line)
{
ptr_prefix = line->data->prefix;
prefix_length = line->data->prefix_length;
ptr_prefix_color = NULL;
}
else
{
gui_line_get_prefix_for_display (line, &ptr_prefix, &prefix_length,
&ptr_prefix_color);
}
gui_line_get_prefix_for_display (line, &ptr_prefix, &prefix_length,
&ptr_prefix_color);
if (ptr_prefix)
{
ptr_prefix2 = NULL;
@ -1022,17 +1012,6 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
if (!line)
return 0;
if ((count == 0) && !GUI_WINDOW_OBJECTS(window)->first_line_with_prefix)
{
GUI_WINDOW_OBJECTS(window)->first_line_with_prefix = line;
GUI_WINDOW_OBJECTS(window)->force_prefix_for_line = 1;
}
else
{
if (line != GUI_WINDOW_OBJECTS(window)->first_line_with_prefix)
GUI_WINDOW_OBJECTS(window)->force_prefix_for_line = 0;
}
if (simulate)
{
x = window->win_chat_cursor_x;
@ -1123,8 +1102,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
if (word_length > 0)
{
line_align = gui_line_get_align (window->buffer, line, 1,
(lines_displayed == 0) ? 1 : 0,
GUI_WINDOW_OBJECTS(window)->force_prefix_for_line);
(lines_displayed == 0) ? 1 : 0);
if ((window->win_chat_cursor_x + word_length_with_spaces > gui_chat_get_real_width (window))
&& (word_length <= gui_chat_get_real_width (window) - line_align))
{
@ -1384,8 +1362,6 @@ gui_chat_draw_formatted_buffer (struct t_gui_window *window)
struct t_gui_line *ptr_line;
int line_pos, count, old_scrolling, old_lines_after;
GUI_WINDOW_OBJECTS(window)->first_line_with_prefix = NULL;
/* display at position of scrolling */
if (window->scroll->start_line)
{
@ -1402,7 +1378,6 @@ gui_chat_draw_formatted_buffer (struct t_gui_window *window)
}
count = 0;
GUI_WINDOW_OBJECTS(window)->first_line_with_prefix = NULL;
if (line_pos > 0)
{
@ -1420,7 +1395,6 @@ gui_chat_draw_formatted_buffer (struct t_gui_window *window)
(ptr_line == gui_line_get_first_displayed (window->buffer));
/* display lines */
GUI_WINDOW_OBJECTS(window)->first_line_with_prefix = NULL;
while (ptr_line && (window->win_chat_cursor_y <= window->win_chat_height - 1))
{
count = gui_chat_display_line (window, ptr_line, 0, 0);

View File

@ -2397,6 +2397,4 @@ gui_window_objects_print_log (struct t_gui_window *window)
log_printf (" win_chat. . . . . . . : 0x%lx", GUI_WINDOW_OBJECTS(window)->win_chat);
log_printf (" win_separator_horiz . : 0x%lx", GUI_WINDOW_OBJECTS(window)->win_separator_horiz);
log_printf (" win_separator_vertic. : 0x%lx", GUI_WINDOW_OBJECTS(window)->win_separator_vertic);
log_printf (" first_line_with_prefix: 0x%lx", GUI_WINDOW_OBJECTS(window)->first_line_with_prefix);
log_printf (" force_prefix_for_line : %d", GUI_WINDOW_OBJECTS(window)->force_prefix_for_line);
}

View File

@ -50,10 +50,6 @@ struct t_gui_window_curses_objects
WINDOW *win_chat; /* chat window (example: channel) */
WINDOW *win_separator_horiz; /* horizontal separator (optional) */
WINDOW *win_separator_vertic; /* vertical separator (optional) */
struct t_gui_line *first_line_with_prefix;
/* first (full) line displayed with a */
/* prefix (for opt "prefix_same_nick") */
int force_prefix_for_line; /* =1 if prefix is displayed for line */
};
struct t_gui_bar_window_curses_objects

View File

@ -200,7 +200,7 @@ gui_line_get_prefix_for_display (struct t_gui_line *line,
int
gui_line_get_align (struct t_gui_buffer *buffer, struct t_gui_line *line,
int with_suffix, int first_line, int force_prefix_for_line)
int with_suffix, int first_line)
{
int length_time, length_buffer, length_suffix, prefix_length;
@ -252,10 +252,7 @@ gui_line_get_align (struct t_gui_buffer *buffer, struct t_gui_line *line,
return length_time + length_buffer;
}
if (force_prefix_for_line)
prefix_length = line->data->prefix_length;
else
gui_line_get_prefix_for_display (line, NULL, &prefix_length, NULL);
gui_line_get_prefix_for_display (line, NULL, &prefix_length, NULL);
if (CONFIG_INTEGER(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_NONE)
{

View File

@ -72,8 +72,7 @@ extern void gui_line_get_prefix_for_display (struct t_gui_line *line,
char **color);
extern int gui_line_get_align (struct t_gui_buffer *buffer,
struct t_gui_line *line,
int with_suffix, int first_line,
int force_prefix_for_line);
int with_suffix, int first_line);
extern int gui_line_is_displayed (struct t_gui_line *line);
extern struct t_gui_line *gui_line_get_first_displayed (struct t_gui_buffer *buffer);
extern struct t_gui_line *gui_line_get_last_displayed (struct t_gui_buffer *buffer);