changeset 2836:ec672ea5ac2c

Applied SAMI patch by Evgeny Chukreev <codedj at echo dot ru>
author atmos4
date Sun, 11 Nov 2001 15:41:17 +0000
parents 86fdf7897315
children c63562f5f56f
files subreader.c
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/subreader.c	Sun Nov 11 15:35:11 2001 +0000
+++ b/subreader.c	Sun Nov 11 15:41:17 2001 +0000
@@ -89,16 +89,21 @@
  
 	case 3: /* get all text until '<' appears */
 	    if (*s == '\0') { break; }
-	    else if (*s == '<') { state = 4; }
-	    else if (!strncasecmp (s, "&nbsp;", 6)) { *p++ = ' '; s += 6; }
-	    else if (*s == '\r') { s++; }
-	    else if (!strncasecmp (s, "<br>", 4) || *s == '\n') {
+	    else if (!strncasecmp (s, "<br>", 4)) {
 		*p = '\0'; p = text; trail_space (text);
 		if (text[0] != '\0')
 		    current->text[current->lines++] = strdup (text);
-		if (*s == '\n') s++; else s += 4;
+		s += 4;
 	    }
+	    else if (*s == '<') { state = 4; }
+	    else if (!strncasecmp (s, "&nbsp;", 6)) { *p++ = ' '; s += 6; }
+	    else if (*s == '\t') { *p++ = ' '; s++; }
+	    else if (*s == '\r' || *s == '\n') { s++; }
 	    else *p++ = *s++;
+
+	    /* skip duplicated space */
+	    if (p > text + 2) if (*(p-1) == ' ' && *(p-2) == ' ') p--;
+	    
 	    continue;
 
 	case 4: /* get current->end or skip <TAG> */