From unknown Sun Aug 10 16:50:52 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#18267 <18267@debbugs.gnu.org> To: bug#18267 <18267@debbugs.gnu.org> Subject: Status: eww: should trim contents, which affects history Reply-To: bug#18267 <18267@debbugs.gnu.org> Date: Sun, 10 Aug 2025 23:50:52 +0000 retitle 18267 eww: should trim <title /> contents, which affects history=20 reassign 18267 emacs submitter 18267 Ivan Shmakov <ivan@siamics.net> severity 18267 minor tag 18267 fixed patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 14 17:15:35 2014 Received: (at submit) by debbugs.gnu.org; 14 Aug 2014 21:15:35 +0000 Received: from localhost ([127.0.0.1]:43659 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1XI2Mw-0007ug-9y for submit@debbugs.gnu.org; Thu, 14 Aug 2014 17:15:34 -0400 Received: from fely.am-1.org ([78.47.74.50]:50522) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <ivan@siamics.net>) id 1XI2Ms-0007uS-B5 for submit@debbugs.gnu.org; Thu, 14 Aug 2014 17:15:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:Date:Sender:Subject:To:From; bh=jcyDUvn+jKH1LezoaSwLmu7sFfTTbuew/3N4lmrS6DI=; b=Wm16TDzuNktgVl3tznq0q8Tk6WAtmR2tPurZlDWnUbcVFTIB9hweV+5hL6bwTS419uX1lYkwuiMP0fDWwUmwzl5Y4yXgrHALFlge3bonUUQKL/wzPvJ285hXEwzb5nry5ne/WpRQy4vnVbRSHCotXcayUNXP5OCb1Hri8/drk6w=; Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <ivan@siamics.net>) id 1XI2Mq-0004Xn-Ge for submit@debbugs.gnu.org; Thu, 14 Aug 2014 21:15:29 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from <ivan@siamics.net>) id 1XI2Mj-0002bZ-CB for submit@debbugs.gnu.org; Fri, 15 Aug 2014 04:15:21 +0700 From: Ivan Shmakov <ivan@siamics.net> To: submit@debbugs.gnu.org Subject: eww: should trim <title /> contents, which affects history Date: Thu, 14 Aug 2014 21:15:20 +0000 Message-ID: <87wqaapyc7.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request@debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit@debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request@debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request@debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> X-Spam-Score: 0.7 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. 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: =E2=80=A2 eww-tag-title is changed to strip any [[:blank:]\r\n]+ from the element textual content; (it may also turn any embedded [\r\n] codes into ordinary blanks, though it isn=E2=80=99t /strictly/ necessary given the rest of the changes below); =E2=80=A2 eww-list-histories turns any control characters in :title into something printable (say, using the caret notation; ^J for \n, etc.; this doesn=E2=80=99t cover non-ASCII controls, though); =E2=80=A2 the eww-history property is made to cover the whole *eww-history* entry, =E2=80=93 not just its initial character; conversely, eww-history-browse is changed to use (point) instead of (line-beginning-position). Also, while we=E2=80=99re at it, I suggest getting rid of the right-padding of the /last/ (as in: second) field of the history records, for it=E2=80=99s 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.) --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A --=-=-= Content-Type: text/x-diff Content-Disposition: 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) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 10 16:25:56 2014 Received: (at 18267) by debbugs.gnu.org; 10 Nov 2014 21:25:56 +0000 Received: from localhost ([127.0.0.1]:56378 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1XnwTE-0002Lz-19 for submit@debbugs.gnu.org; Mon, 10 Nov 2014 16:25:56 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:37181) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <larsi@gnus.org>) id 1XnwTC-0002Lj-0Z for 18267@debbugs.gnu.org; Mon, 10 Nov 2014 16:25:54 -0500 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from <larsi@gnus.org>) id 1XnwSt-0001dl-Ez; Mon, 10 Nov 2014 22:25:35 +0100 From: Lars Magne Ingebrigtsen <larsi@gnus.org> To: Ivan Shmakov <ivan@siamics.net> Subject: Re: bug#18267: eww: should trim <title /> contents, which affects history References: <87wqaapyc7.fsf@violet.siamics.net> X-Now-Playing: The Cure's _Kiss Me, Kiss Me, Kiss Me_ X-Hashcash: 1:23:141110:18267@debbugs.gnu.org::oZU6Qftp283isd3e:0000000000000000000000000000000000000000EB/v X-Hashcash: 1:23:141110:ivan@siamics.net::5mOQz8rEsRX1RTi5:0YfyA Date: Mon, 10 Nov 2014 22:25:34 +0100 In-Reply-To: <87wqaapyc7.fsf@violet.siamics.net> (Ivan Shmakov's message of "Thu, 14 Aug 2014 21:15:20 +0000") Message-ID: <m3ioimhho1.fsf@stories.gnus.org> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1XnwSt-0001dl-Ez X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1416259536.11122@T4PKxEDBonqahuOySW+eVw X-Spam-Status: No X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 18267 Cc: 18267@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request@debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit@debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request@debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request@debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> X-Spam-Score: 0.0 (/) Ivan Shmakov <ivan@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 From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 10 16:25:56 2014 Received: (at control) by debbugs.gnu.org; 10 Nov 2014 21:25:56 +0000 Received: from localhost ([127.0.0.1]:56380 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1XnwTE-0002M1-Ci for submit@debbugs.gnu.org; Mon, 10 Nov 2014 16:25:56 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:37185) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <larsi@gnus.org>) id 1XnwTD-0002Lq-CL for control@debbugs.gnu.org; Mon, 10 Nov 2014 16:25:55 -0500 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from <larsi@gnus.org>) id 1XnwSv-0001ds-J6 for control@debbugs.gnu.org; Mon, 10 Nov 2014 22:25:37 +0100 Date: Mon, 10 Nov 2014 22:25:37 +0100 Message-Id: <m3h9y6hhny.fsf@stories.gnus.org> To: control@debbugs.gnu.org From: Lars Magne Ingebrigtsen <larsi@gnus.org> Subject: control message for bug #18267 X-MailScanner-ID: 1XnwSv-0001ds-J6 X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1416259537.81144@sDPSfIb6Ql/6rFAd49hoCw X-Spam-Status: No X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request@debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit@debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request@debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request@debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> X-Spam-Score: 0.0 (/) tags 18267 fixed close 18267 25.1 From unknown Sun Aug 10 16:50:52 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request <help-debbugs@gnu.org> Subject: Internal Control Message-Id: bug archived. Date: Tue, 09 Dec 2014 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator