emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 196dc88: Further shr line folding/link continuation


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 196dc88: Further shr line folding/link continuation tweaks
Date: Sat, 14 Apr 2018 16:39:13 -0400 (EDT)

branch: master
commit 196dc887d8ba324df01d594d5eda61591e251ff0
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Further shr line folding/link continuation tweaks
    
    * lisp/net/shr.el (shr-fill-line): Tweak the link continuations
    further when folding lines.
---
 lisp/net/shr.el | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index d12ee68..5eb35b7 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -734,18 +734,25 @@ size, and full-buffer size."
            (skip-chars-forward " ")
            (search-forward " " (line-end-position) 'move)))
       ;; Success; continue.
-      (let ((props (copy-sequence (text-properties-at (point))))
-           (gap-start (point)))
-        (when (= (preceding-char) ?\s)
-         (delete-char -1))
-        ;; We don't want to use the faces on the indentation, because
-        ;; that's ugly, but we want all the other properties to be
-        ;; continuous so that links do not split up into many links
-        ;; (which makes navigation awkward).
-        (setq props (plist-put props 'face nil))
+      (when (= (preceding-char) ?\s)
+       (delete-char -1))
+      (let ((gap-start (point)))
        (insert "\n")
        (shr-indent)
-       (add-text-properties gap-start (point) props))
+        (when (and (> (1- gap-start) (point-min))
+                   ;; The link on both sides of the newline are the
+                   ;; same...
+                   (equal (get-text-property (point) 'shr-url)
+                          (get-text-property (1- gap-start) 'shr-url)))
+          ;; ... so we join the two bits into one link logically, but
+          ;; not visually.  This makes navigation between links work
+          ;; well, but avoids underscores before the link on the next
+          ;; line when indented.
+          (let ((props (copy-sequence (text-properties-at (point)))))
+            ;; We don't want to use the faces on the indentation, because
+            ;; that's ugly.
+            (setq props (plist-put props 'face nil))
+           (add-text-properties gap-start (point) props))))
       (setq start (point))
       (shr-vertical-motion shr-internal-width)
       (when (looking-at " $")



reply via email to

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