summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorRichardHitt <rbh00@netcom.com>2014-03-29 14:27:23 -0700
committerRichardHitt <rbh00@netcom.com>2014-03-29 14:31:19 -0700
commit4ca9672a920c46fcc01aa65744e829a02e9d4ec5 (patch)
tree8a7de305491f3c84233d4b39e0cb36ef93e7d3de /src/common
parent1a3bfdce75822a2c3cdf2ee23a266eb0ffbe4775 (diff)
Fix scrollback_load to deal with e.g. the output of /HELP
Fixes #928.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/text.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/common/text.c b/src/common/text.c
index 96442e6e..e7cef398 100644
--- a/src/common/text.c
+++ b/src/common/text.c
@@ -303,6 +303,12 @@ 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)
@@ -310,7 +316,7 @@ scrollback_load (session *sess)
 				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)
 					{
@@ -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);
 		}