GNU bug report logs -
#18267
eww: should trim <title /> contents, which affects history
Previous Next
Reported by: Ivan Shmakov <ivan <at> siamics.net>
Date: Thu, 14 Aug 2014 21:16:01 UTC
Severity: minor
Tags: fixed, patch
Fixed in version 25.1
Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18267 in the body.
You can then email your comments to 18267 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18267
; Package
emacs
.
(Thu, 14 Aug 2014 21:16:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ivan Shmakov <ivan <at> siamics.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 14 Aug 2014 21:16:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Package: emacs
Severity: minor
Tags: patch
EWW currently fails to trim any leading and trailing whitespace
/and/ newline codes off the <title /> contents, as in the
following (valid) HTML document:
<!DOCTYPE html>
<title>
A title with newlines.
</title>
Here, eww-current-title will be "\nA title with newlines.\n",
which causes the *eww-history* buffer contents to be formatted like:
A title with newlines.
http://example.org/
Which, in turn, causes eww-history-browse to fail (unless used
on the first line of such an entry), due to the use of
(line-beginning-position):
(let ((history (get-text-property (line-beginning-position) 'eww-history)))
(unless history
(error "No history on the current line"))
(quit-window)
I suggest that this issue be resolved as follows:
• eww-tag-title is changed to strip any [[:blank:]\r\n]+ from
the <title /> element textual content; (it may also turn any
embedded [\r\n] codes into ordinary blanks, though it isn’t
/strictly/ necessary given the rest of the changes below);
• eww-list-histories turns any control characters in :title into
something printable (say, using the caret notation; ^J for \n,
etc.; this doesn’t cover non-ASCII controls, though);
• the eww-history property is made to cover the whole
*eww-history* entry, – not just its initial character;
conversely, eww-history-browse is changed to use (point)
instead of (line-beginning-position).
Also, while we’re at it, I suggest getting rid of the
right-padding of the /last/ (as in: second) field of the history
records, for it’s entirely unnecessary, and makes copying the
URIs from *eww-history* harder.
A possible patch is MIMEd. (Note that the eww-tag-title change
looks a bit too verbose, though.)
--
FSF associate member #7257 http://boycottsystemd.org/ … 3013 B6A0 230E 334A
[Message part 2 (text/x-diff, inline)]
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -344,10 +387,20 @@ word(s) will be searched for via `eww-search-prefix'."
(setq header-line-format nil)))
(defun eww-tag-title (cont)
- (setq eww-current-title "")
- (dolist (sub cont)
- (when (eq (car sub) 'text)
- (setq eww-current-title (concat eww-current-title (cdr sub)))))
+ (setq eww-current-title
+ (with-temp-buffer
+ (dolist (sub cont)
+ (when (eq (car sub) 'text)
+ (insert (cdr sub))))
+ ;; trim leading and trailing whitespace
+ (goto-char (point-min))
+ (when (re-search-forward "^[[:blank:]\r\n]+" nil t)
+ (replace-match ""))
+ (goto-char (point-max))
+ (when (re-search-backward "[[:blank:]\r\n]+$" nil t)
+ (replace-match ""))
+ ;; .
+ (buffer-string)))
(eww-update-header-line-format))
(defun eww-tag-body (cont)
@@ -1303,23 +1370,29 @@ Differences in #targets are ignored."
(setq start (point))
(setq domain-length (max domain-length (length (plist-get history :url))))
(setq title-length (max title-length (length (plist-get history :title)))))
- (setq format (format "%%-%ds %%-%ds" title-length domain-length)
+ (setq format (format "%%-%ds %%s" title-length)
header-line-format
(concat " " (format format "Title" "URL")))
(dolist (history eww-history-trans)
(setq start (point))
(setq url (plist-get history :url))
- (setq title (plist-get history :title))
+ (with-temp-buffer
+ (insert (plist-get history :title))
+ (goto-char (point-min))
+ (while (re-search-forward "[\000-\037]" nil t)
+ (replace-match
+ (string ?^ (logior ?@ (aref (match-string 0) 0)))))
+ (setq title (buffer-string)))
(insert (format format title url))
(insert "\n")
- (put-text-property start (1+ start) 'eww-history history))
+ (put-text-property start (point) 'eww-history history))
(goto-char (point-min)))
(pop-to-buffer "*eww history*")))
(defun eww-history-browse ()
"Browse the history under point in eww."
(interactive)
- (let ((history (get-text-property (line-beginning-position) 'eww-history)))
+ (let ((history (get-text-property (point) 'eww-history)))
(unless history
(error "No history on the current line"))
(quit-window)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18267
; Package
emacs
.
(Mon, 10 Nov 2014 21:26:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 18267 <at> debbugs.gnu.org (full text, mbox):
Ivan Shmakov <ivan <at> siamics.net> writes:
> EWW currently fails to trim any leading and trailing whitespace
> /and/ newline codes off the <title /> contents, as in the
> following (valid) HTML document:
This was fixed a couple of days ago, I think.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Magne Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 10 Nov 2014 21:26:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 25.1, send any further explanations to
18267 <at> debbugs.gnu.org and Ivan Shmakov <ivan <at> siamics.net>
Request was from
Lars Magne Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 10 Nov 2014 21:26:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 09 Dec 2014 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 246 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.