summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-04-09 00:18:29 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-04-19 16:47:44 +0200
commit07fa6b12a6d0e3f351050cad761bdaa467382bfb (patch)
tree33012804a77fa09d8998ec4bbe6504fd1ba48e03
parent031bd45e360ce619838d0197442cd39734b0b96f (diff)
downloadweechat-07fa6b12a6d0e3f351050cad761bdaa467382bfb.zip
core: don't split on newline characters in printf_date_tags
With support for rendering newline characters as new lines, we don't need to split the message on newline characters anymore in printf_date_tags. This allows you to print a line with multiple lines.
-rw-r--r--src/gui/gui-chat.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c
index e9b06a7a4..66c7ee681 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -849,7 +849,6 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
const char *tags, const char *message, ...)
{
time_t date_printed;
- char *pos, *pos_end;
if (!message)
return;
@@ -872,25 +871,14 @@ gui_chat_printf_date_tags (struct t_gui_buffer *buffer, time_t date,
if (date <= 0)
date = date_printed;
- pos = vbuffer;
- while (pos)
+ if (gui_init_ok)
{
- /* display until next end of line */
- pos_end = strchr (pos, '\n');
- if (pos_end)
- pos_end[0] = '\0';
-
- if (gui_init_ok)
- {
- gui_chat_printf_date_tags_internal (buffer, date, date_printed,
- tags, pos);
- }
- else
- {
- gui_chat_add_line_waiting_buffer (pos);
- }
-
- pos = (pos_end && pos_end[1]) ? pos_end + 1 : NULL;
+ gui_chat_printf_date_tags_internal (buffer, date, date_printed,
+ tags, vbuffer);
+ }
+ else
+ {
+ gui_chat_add_line_waiting_buffer (vbuffer);
}
free (vbuffer);