diff options
author | Vibhav Pant <vibhavp@gmail.com> | 2020-08-21 14:04:35 +0530 |
---|---|---|
committer | Vibhav Pant <vibhavp@gmail.com> | 2020-08-21 14:04:35 +0530 |
commit | f0f8d7b82492e741950c363a03b886965c91b1b0 (patch) | |
tree | 19b716830b1ebabc0d7d75949c4e6800c0f104ad /lisp/net/eww.el | |
parent | 9e64a087c4d167e7ec1c4e22bea3e6af53b563de (diff) | |
parent | c818c29771d3cb51875643b2f6c894073e429dd2 (diff) | |
download | emacs-feature/native-comp-macos-fixes.tar.gz |
Merge branch 'feature/native-comp' into feature/native-comp-macos-fixesfeature/native-comp-macos-fixes
Diffstat (limited to 'lisp/net/eww.el')
-rw-r--r-- | lisp/net/eww.el | 25 |
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." (setq header-line-format (and eww-header-line-format (let ((title (plist-get eww-data :title)) - (peer (plist-get eww-data :peer))) + (peer (plist-get eww-data :peer)) + (url (plist-get eww-data :url))) (when (zerop (length title)) (setq title "[untitled]")) + ;; Limit the length of the title so that the host name + ;; of the URL is always visible. + (when url + (let* ((parsed (url-generic-parse-url url)) + (host-length (length (format "%s://%s" + (url-type parsed) + (url-host parsed)))) + (width (window-width))) + (cond + ;; The host bit is wider than the window, so nix + ;; the title. + ((> (+ host-length 5) width) + (setq title "")) + ;; Trim the title. + ((> (+ (length title) host-length 2) width) + (setq title (concat + (substring title 0 (- width + host-length + 5)) + "...")))))) ;; This connection has is https. (when peer (setq title @@ -686,7 +707,7 @@ Currently this means either text/html or application/xhtml+xml." "%" "%%" (format-spec eww-header-line-format - `((?u . ,(or (plist-get eww-data :url) "")) + `((?u . ,(or url "")) (?t . ,title)))))))) (defun eww-tag-title (dom) |