emacs-diffs
[Top][All Lists]
Advanced

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

master 0de7efe897b 5/6: Don't insert subscript on a newline


From: Eli Zaretskii
Subject: master 0de7efe897b 5/6: Don't insert subscript on a newline
Date: Sat, 25 Nov 2023 05:58:35 -0500 (EST)

branch: master
commit 0de7efe897b54e703f05c192f064e143e3426b2d
Author: Rahguzar <rahguzar@zohomail.eu>
Commit: Eli Zaretskii <eliz@gnu.org>

    Don't insert subscript on a newline
    
    * lisp/net/shr.el (shr-tag-sub): Don't insert subscript on a
    newline.  (Bug#66676)
---
 lisp/net/shr.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 71c16ebd126..9f030b4c743 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1451,6 +1451,13 @@ ones, in case fg and bg are nil."
     (add-face-text-property start (point) 'shr-sup)))
 
 (defun shr-tag-sub (dom)
+  ;; Why would a subscript be at the beginning of a line?  It does
+  ;; happen sometimes because of a <br> tag and the intent seems to be
+  ;; alignment of subscript and superscript but I don't think that is
+  ;; possible in Emacs.  So we remove the newline in that case.
+  (when (bolp)
+    (forward-char -1)
+    (delete-char 1))
   (let ((start (point)))
     (shr-generic dom)
     (put-text-property start (point) 'display `(raise ,shr-sub-raise-factor))



reply via email to

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