branch: externals/org
commit 312f39a05d083fb23e55ad306bc9ebad345b9508
Author: Ihor Radchenko <yanta...@gmail.com>
Commit: Ihor Radchenko <yanta...@gmail.com>

    org-string-width: Do not remove face info when PIXELS is non-nil
    
    * lisp/org-macs.el (org-string-width): Do not remove the STRING faces
    unless character width is requested.  Faces might alter pixel width of
    the string and removing them would yield incorrect results.
---
 lisp/org-macs.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 9e24e315a5..fa3d210e63 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -968,12 +968,15 @@ Return width in pixels when PIXELS is non-nil."
       (org--string-width-1 string)
     ;; Wrap/line prefix will make `window-text-pizel-size' return too
     ;; large value including the prefix.
-    ;; Face should be removed to make sure that all the string symbols
-    ;; are using default face with constant width.  Constant char width
-    ;; is critical to get right string width from pixel width.
     (remove-text-properties 0 (length string)
-                            '(wrap-prefix t line-prefix t face t)
+                            '(wrap-prefix t line-prefix t)
                             string)
+    ;; Face should be removed to make sure that all the string symbols
+    ;; are using default face with constant width.  Constant char width
+    ;; is critical to get right string width from pixel width (not needed
+    ;; when PIXELS are requested though).
+    (unless pixels
+      (remove-text-properties 0 (length string) '(face t) string))
     (let (;; We need to remove the folds to make sure that folded table
           ;; alignment is not messed up.
           (current-invisibility-spec

Reply via email to