summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2007-11-04 18:48:57 +0100
committerSebastien Helleu <flashcode@flashtux.org>2007-11-04 18:48:57 +0100
commita98feff2bb2b85d1fff33f511ca645f04f2af1ff (patch)
tree6826353cf24dfbd8d144961ef3a7ce14c21b493b /src
parent1a0472c5dd71888440b4a835a71b38d0b2b6c7ba (diff)
downloadweechat-a98feff2bb2b85d1fff33f511ca645f04f2af1ff.zip
Fixed display bug with truncation of long lines
Diffstat (limited to 'src')
-rw-r--r--src/gui/curses/gui-curses-chat.c17
-rw-r--r--src/gui/gui-chat.c21
-rw-r--r--src/gui/gui-chat.h2
3 files changed, 31 insertions, 9 deletions
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index 1c6ce7f71..dd0e86c69 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -438,7 +438,7 @@ gui_chat_display_word (struct t_gui_window *window,
int prefix, int num_lines, int count,
int *lines_displayed, int simulate)
{
- char *end_line, saved_char_end, saved_char;
+ char *end_line, saved_char_end, saved_char, str_space[] = " ";
int pos_saved_char, chars_to_display, num_displayed;
int length_align;
@@ -462,7 +462,7 @@ gui_chat_display_word (struct t_gui_window *window,
while (data && data[0])
{
/* insert spaces for align text under time/nick */
- length_align = gui_chat_get_line_align (window->buffer, line);
+ length_align = gui_chat_get_line_align (window->buffer, line, 0);
if ((length_align > 0) &&
(window->win_chat_cursor_x == 0) &&
(*lines_displayed > 0) &&
@@ -477,6 +477,17 @@ gui_chat_display_word (struct t_gui_window *window,
wclrtoeol (GUI_CURSES(window)->win_chat);
}
window->win_chat_cursor_x += length_align;
+ if (!simulate
+ && (cfg_look_prefix_align != CFG_LOOK_PREFIX_ALIGN_NONE)
+ && (cfg_look_prefix_suffix && cfg_look_prefix_suffix[0]))
+ {
+ gui_chat_set_weechat_color (window, GUI_COLOR_CHAT_PREFIX_SUFFIX);
+ gui_chat_display_word_raw (window, cfg_look_prefix_suffix, 1);
+ window->win_chat_cursor_x += gui_chat_strlen_screen (cfg_look_prefix_suffix);
+ gui_chat_display_word_raw (window, str_space, 1);
+ window->win_chat_cursor_x += gui_chat_strlen_screen (str_space);
+ gui_chat_set_weechat_color (window, GUI_COLOR_CHAT);
+ }
}
chars_to_display = gui_chat_strlen_screen (data);
@@ -723,7 +734,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
if (word_length > 0)
{
/* spaces + word too long for current line but ok for next line */
- line_align = gui_chat_get_line_align (window->buffer, line);
+ line_align = gui_chat_get_line_align (window->buffer, line, 1);
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))
{
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c
index 412a326a0..3e4a1a31b 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -122,7 +122,7 @@ gui_chat_string_real_pos (char *string, int pos)
real_pos = string;
ptr_string = string;
- while (ptr_string && ptr_string[0] && (pos >= 0))
+ while (ptr_string && ptr_string[0] && (pos > 0))
{
ptr_string = gui_chat_string_next_char (NULL,
(unsigned char *)ptr_string,
@@ -319,15 +319,26 @@ gui_chat_change_time_format ()
*/
int
-gui_chat_get_line_align (struct t_gui_buffer *buffer, struct t_gui_line *line)
+gui_chat_get_line_align (struct t_gui_buffer *buffer, struct t_gui_line *line,
+ int with_suffix)
{
+ int length_suffix;
+
if (cfg_look_prefix_align == CFG_LOOK_PREFIX_ALIGN_NONE)
return gui_chat_time_length + 1 + line->prefix_length + 2;
-
+
+ length_suffix = 0;
+ if (with_suffix)
+ {
+ if (cfg_look_prefix_suffix && cfg_look_prefix_suffix[0])
+ length_suffix = gui_chat_strlen_screen (cfg_look_prefix_suffix) + 1;
+ }
if (cfg_look_prefix_align_max > 0)
- return gui_chat_time_length + 1 + cfg_look_prefix_align_max + 2 + 1;
+ return gui_chat_time_length + 1 + cfg_look_prefix_align_max +
+ length_suffix + 1;
else
- return gui_chat_time_length + 1 + buffer->prefix_max_length + 2 + 1;
+ return gui_chat_time_length + 1 + buffer->prefix_max_length +
+ length_suffix + 1;
}
/*
diff --git a/src/gui/gui-chat.h b/src/gui/gui-chat.h
index b95de01f6..e2a341924 100644
--- a/src/gui/gui-chat.h
+++ b/src/gui/gui-chat.h
@@ -46,7 +46,7 @@ extern void gui_chat_get_word_info (struct t_gui_window *,
char *, int *, int *, int *, int *);
extern void gui_chat_change_time_format ();
extern int gui_chat_get_line_align (struct t_gui_buffer *,
- struct t_gui_line *);
+ struct t_gui_line *, int);
extern int gui_chat_line_search (struct t_gui_line *, char *, int);
extern void gui_chat_line_free (struct t_gui_line *);
extern void gui_chat_printf (struct t_gui_buffer *, char *, ...);