Skip to content

Commit

Permalink
Merge pull request hexchat#929 from hexchat/928
Browse files Browse the repository at this point in the history
Fix scrollback_load to deal with e.g. the output of /HELP
  • Loading branch information
RichardHitt committed Mar 31, 2014
2 parents 1a3bfdc + 4ca9672 commit 5e8bc98
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/common/text.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,14 +303,20 @@ scrollback_load (session *sess)
buf = g_strndup (buf_tmp, n_bytes);
g_free (buf_tmp);

/*
* Some scrollback lines have three blanks after the timestamp and a newline
* Some have only one blank and a newline
* Some don't even have a timestamp
* Some don't have any text at all
*/
if (buf[0] == 'T')
{
if (sizeof (time_t) == 4)
stamp = strtoul (buf + 2, NULL, 10);
else
stamp = strtoull (buf + 2, NULL, 10); /* in case time_t is 64 bits */
text = strchr (buf + 3, ' ');
if (text)
if (text && text[1])
{
if (prefs.hex_text_stripcolor_replay)
{
Expand All @@ -324,8 +330,19 @@ scrollback_load (session *sess)
g_free (text);
}
}
lines++;
else
{
fe_print_text (sess, " ", stamp, TRUE);
}
}
else
{
if (strlen (buf))
fe_print_text (sess, buf, 0, TRUE);
else
fe_print_text (sess, " ", 0, TRUE);
}
lines++;

g_free (buf);
}
Expand Down

0 comments on commit 5e8bc98

Please sign in to comment.