diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-04-25 16:40:11 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-04-25 16:40:11 +0200 |
commit | 4bef226f339b812307f1e8e4146f45f0ac74b8f7 (patch) | |
tree | b50d7daf279e48e242acfe076471da555f5386fb /src | |
parent | cf4f86917478137043ca8f316ce61d26259fdfd5 (diff) | |
download | weechat-4bef226f339b812307f1e8e4146f45f0ac74b8f7.zip |
Fixed bug with print_y: now scripts can print empty line to remove a line
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/gui-chat.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index 921699d4e..8aa904cf6 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -929,8 +929,19 @@ gui_chat_printf_y (struct t_gui_buffer *buffer, int y, char *message, ...) return; } + /* with message: create line or merge content with existing line */ + buf = malloc (GUI_CHAT_BUFFER_PRINTF_SIZE); + if (!buf) + return; + + va_start (argptr, message); + vsnprintf (buf, GUI_CHAT_BUFFER_PRINTF_SIZE, message, argptr); + va_end (argptr); + + utf8_normalize (buf, '?'); + /* no message: delete line */ - if (!message) + if (!buf[0]) { if (gui_init_ok) { @@ -949,17 +960,6 @@ gui_chat_printf_y (struct t_gui_buffer *buffer, int y, char *message, ...) } else { - /* with message: create line or merge content with existing line */ - buf = malloc (GUI_CHAT_BUFFER_PRINTF_SIZE); - if (!buf) - return; - - va_start (argptr, message); - vsnprintf (buf, GUI_CHAT_BUFFER_PRINTF_SIZE, message, argptr); - va_end (argptr); - - utf8_normalize (buf, '?'); - if (gui_init_ok) { gui_chat_line_add_y (buffer, y, buf); @@ -967,7 +967,7 @@ gui_chat_printf_y (struct t_gui_buffer *buffer, int y, char *message, ...) } else string_iconv_fprintf (stdout, "%s\n", buf); - - free (buf); } + + free (buf); } |