aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/net/eww.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/net/eww.el')
-rw-r--r--lisp/net/eww.el25
1 files changed, 23 insertions, 2 deletions
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index e7170b3e6d1..04deb5bee05 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -672,9 +672,30 @@ Currently this means either text/html or application/xhtml+xml."
672 (setq header-line-format 672 (setq header-line-format
673 (and eww-header-line-format 673 (and eww-header-line-format
674 (let ((title (plist-get eww-data :title)) 674 (let ((title (plist-get eww-data :title))
675 (peer (plist-get eww-data :peer))) 675 (peer (plist-get eww-data :peer))
676 (url (plist-get eww-data :url)))
676 (when (zerop (length title)) 677 (when (zerop (length title))
677 (setq title "[untitled]")) 678 (setq title "[untitled]"))
679 ;; Limit the length of the title so that the host name
680 ;; of the URL is always visible.
681 (when url
682 (let* ((parsed (url-generic-parse-url url))
683 (host-length (length (format "%s://%s"
684 (url-type parsed)
685 (url-host parsed))))
686 (width (window-width)))
687 (cond
688 ;; The host bit is wider than the window, so nix
689 ;; the title.
690 ((> (+ host-length 5) width)
691 (setq title ""))
692 ;; Trim the title.
693 ((> (+ (length title) host-length 2) width)
694 (setq title (concat
695 (substring title 0 (- width
696 host-length
697 5))
698 "..."))))))
678 ;; This connection has is https. 699 ;; This connection has is https.
679 (when peer 700 (when peer
680 (setq title 701 (setq title
@@ -686,7 +707,7 @@ Currently this means either text/html or application/xhtml+xml."
686 "%" "%%" 707 "%" "%%"
687 (format-spec 708 (format-spec
688 eww-header-line-format 709 eww-header-line-format
689 `((?u . ,(or (plist-get eww-data :url) "")) 710 `((?u . ,(or url ""))
690 (?t . ,title)))))))) 711 (?t . ,title))))))))
691 712
692(defun eww-tag-title (dom) 713(defun eww-tag-title (dom)