emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master cbb6f13: shr space widths fixup


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master cbb6f13: shr space widths fixup
Date: Wed, 11 Feb 2015 03:34:34 +0000

branch: master
commit cbb6f138e661b11e03885f00041e6442ed12a6a5
Author: Lars Magne Ingebrigtsen <address@hidden>
Commit: Lars Magne Ingebrigtsen <address@hidden>

    shr space widths fixup
    
    * lisp/net/shr.el (shr-insert): Make sure the space inserted has the
    right font (for width).
---
 lisp/ChangeLog  |    5 +++++
 lisp/net/shr.el |   51 ++++++++++++++++++++++++++-------------------------
 2 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index eee6744..7274c9d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-11  Lars Ingebrigtsen  <address@hidden>
+
+       * net/shr.el (shr-insert): Make sure the space inserted has the
+       right font (for width).
+
 2015-02-10  Lars Ingebrigtsen  <address@hidden>
 
        * net/shr.el (shr-use-fonts): New variable.
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index a65f792..a432085 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -494,31 +494,32 @@ size, and full-buffer size."
    ((eq shr-folding-mode 'none)
     (insert text))
    (t
-    (when (and (string-match "\\`[ \t\n\r ]" text)
-              (not (bolp))
-              (not (eq (char-after (1- (point))) ? )))
-      (insert " "))
-    (let ((start (point))
-         (bolp (bolp)))
-      (insert text)
-      (save-restriction
-       (narrow-to-region start (point))
-       (goto-char start)
-       (when (looking-at "[ \t\n\r ]+")
-         (replace-match "" t t))
-       (while (re-search-forward "[ \t\n\r ]+" nil t)
-         (replace-match " " t t))
-       (goto-char (point-max)))
-      ;; We may have removed everything we inserted if if was just
-      ;; spaces.
-      (unless (= start (point))
-       ;; Mark all lines that should possibly be folded afterwards.
-       (when bolp
-         (shr-mark-fill start))
-       (when shr-use-fonts
-         (put-text-property start (point)
-                            'face
-                            (or shr-current-font 'variable-pitch))))))))
+    (let ((font-start (point)))
+      (when (and (string-match "\\`[ \t\n\r ]" text)
+                (not (bolp))
+                (not (eq (char-after (1- (point))) ? )))
+       (insert " "))
+      (let ((start (point))
+           (bolp (bolp)))
+       (insert text)
+       (save-restriction
+         (narrow-to-region start (point))
+         (goto-char start)
+         (when (looking-at "[ \t\n\r ]+")
+           (replace-match "" t t))
+         (while (re-search-forward "[ \t\n\r ]+" nil t)
+           (replace-match " " t t))
+         (goto-char (point-max)))
+       ;; We may have removed everything we inserted if if was just
+       ;; spaces.
+       (unless (= font-start (point))
+         ;; Mark all lines that should possibly be folded afterwards.
+         (when bolp
+           (shr-mark-fill start))
+         (when shr-use-fonts
+           (put-text-property font-start (point)
+                              'face
+                              (or shr-current-font 'variable-pitch)))))))))
 
 (defun shr-fill-lines (start end)
   (if (<= shr-internal-width 0)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]