[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 0c29f53ab87: Fix 'string-pixel-width' under 'line-prefix'
From: |
Eli Zaretskii |
Subject: |
emacs-29 0c29f53ab87: Fix 'string-pixel-width' under 'line-prefix' |
Date: |
Mon, 31 Jul 2023 14:51:30 -0400 (EDT) |
branch: emacs-29
commit 0c29f53ab8723dd5a9f31ce8a6e913cc08132e56
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Fix 'string-pixel-width' under 'line-prefix'
* lisp/emacs-lisp/subr-x.el (string-pixel-width): Disable
'line-prefix' and 'wrap-prefix' to avoid their effect on the
calculated string width. (Bug#64971)
---
lisp/emacs-lisp/subr-x.el | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 8cdbdf1ef6a..b164071763b 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -322,12 +322,15 @@ as the new values of the bound variables in the recursive
invocation."
;; Keeping a work buffer around is more efficient than creating a
;; new temporary buffer.
(with-current-buffer (get-buffer-create " *string-pixel-width*")
- ;; `display-line-numbers-mode' is enabled in internal buffers
- ;; that breaks width calculation, so need to disable (bug#59311)
+ ;; If `display-line-numbers-mode' is enabled in internal
+ ;; buffers, it breaks width calculation, so disable it (bug#59311)
(when (bound-and-true-p display-line-numbers-mode)
(display-line-numbers-mode -1))
(delete-region (point-min) (point-max))
- (insert string)
+ ;; Disable line-prefix and wrap-prefix, for the same reason.
+ (setq line-prefix nil
+ wrap-prefix nil)
+ (insert (propertize string 'line-prefix nil 'wrap-prefix nil))
(car (buffer-text-pixel-size nil nil t)))))
;;;###autoload
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 0c29f53ab87: Fix 'string-pixel-width' under 'line-prefix',
Eli Zaretskii <=