Merge remote branch 'origin/no-gnus'
[gnus] / lisp / shr.el
index 11d0f3e..ba1ca1b 100644 (file)
@@ -333,6 +333,7 @@ size, and full-buffer size."
 
 (defun shr-insert (text)
   (when (and (eq shr-state 'image)
+            (not (bolp))
             (not (string-match "\\`[ \t\n]+\\'" text)))
     (insert "\n")
     (setq shr-state nil))
@@ -340,7 +341,7 @@ size, and full-buffer size."
    ((eq shr-folding-mode 'none)
     (insert text))
    (t
-    (when (and (string-match "\\`[ \t\n]" text)
+    (when (and (string-match "\\`[ \t\n ]" text)
               (not (bolp))
               (not (eq (char-after (1- (point))) ? )))
       (insert " "))
@@ -367,6 +368,7 @@ size, and full-buffer size."
       (unless shr-start
        (setq shr-start (point)))
       (insert elem)
+      (setq shr-state nil)
       (let (found)
        (while (and (> (current-column) shr-width)
                    (progn
@@ -383,7 +385,7 @@ size, and full-buffer size."
            (shr-indent))
          (end-of-line))
        (insert " ")))
-    (unless (string-match "[ \t\n]\\'" text)
+    (unless (string-match "[ \t\n ]\\'" text)
       (delete-char -1)))))
 
 (defun shr-find-fill-point ()
@@ -1042,7 +1044,7 @@ ones, in case fg and bg are nil."
     (shr-generic cont)))
 
 (defun shr-tag-br (cont)
-  (unless (bobp)
+  (unless (bolp)
     (insert "\n")
     (shr-indent))
   (shr-generic cont))