[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 740fe3e757: Fix global face scaling bug due to rounding.
From: |
Gregory Heytings |
Subject: |
master 740fe3e757: Fix global face scaling bug due to rounding. |
Date: |
Sat, 19 Nov 2022 10:48:12 -0500 (EST) |
branch: master
commit 740fe3e7575a2f9bb0288eaa7f81b97173b00f6a
Author: Gregory Heytings <gregory@heytings.org>
Commit: Gregory Heytings <gregory@heytings.org>
Fix global face scaling bug due to rounding.
* lisp/face-remap.el (global-text-scale-adjust): Try again if the face
height should have changed but did not actually change. Update the
docstring to clarify the difference with 'text-scale-adjust'.
(global-text-scale-adjust--increment-factor): New internal variable.
Fixes bug#59122.
(text-scale-adjust): Update the docstring to clarify the difference
with 'global-text-scale-adjust'.
---
lisp/face-remap.el | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index f1530285fb..a692015094 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -397,7 +397,11 @@ that have an explicit `:height' setting. The two
exceptions to
this are the `default' and `header-line' faces: they will both be
scaled even if they have an explicit `:height' setting.
-See also the related command `global-text-scale-adjust'."
+See also the related command `global-text-scale-adjust'. Unlike
+that command, which scales the font size with a increment,
+`text-scale-adjust' scales the font size with a factor,
+`text-scale-mode-step'. With a small `text-scale-mode-step'
+factor, the two commands behave similarly."
(interactive "p")
(let ((ev last-command-event)
(echo-keystrokes nil))
@@ -462,6 +466,8 @@ the `cdr' has the maximum font size, in units of 1/10 pt."
(defvar global-text-scale-adjust--default-height nil)
+(defvar global-text-scale-adjust--increment-factor 5)
+
;;;###autoload (define-key ctl-x-map [(control meta ?+)]
'global-text-scale-adjust)
;;;###autoload (define-key ctl-x-map [(control meta ?=)]
'global-text-scale-adjust)
;;;###autoload (define-key ctl-x-map [(control meta ?-)]
'global-text-scale-adjust)
@@ -492,7 +498,10 @@ The variable `global-text-scale-adjust-resizes-frames'
controls
whether the frames are resized to keep the same number of lines
and characters per line when the font size is adjusted.
-See also the related command `text-scale-adjust'."
+See also the related command `text-scale-adjust'. Unlike that
+command, which scales the font size with a factor,
+`global-text-scale-adjust' scales the font size with an
+increment."
(interactive "p")
(when (display-graphic-p)
(unless global-text-scale-adjust--default-height
@@ -503,16 +512,24 @@ See also the related command `text-scale-adjust'."
(cur (face-attribute 'default :height))
(inc
(pcase key
- (?- (* (- increment) 5))
+ (?- (* (- increment)
+ global-text-scale-adjust--increment-factor))
(?0 (- global-text-scale-adjust--default-height cur))
- (_ (* increment 5))))
+ (_ (* increment
+ global-text-scale-adjust--increment-factor))))
(new (+ cur inc)))
(when (< (car global-text-scale-adjust-limits)
new
(cdr global-text-scale-adjust-limits))
(let ((frame-inhibit-implied-resize
(not global-text-scale-adjust-resizes-frames)))
- (set-face-attribute 'default nil :height new)))
+ (set-face-attribute 'default nil :height new)
+ (redisplay 'force)
+ (when (and (not (and (characterp key) (= key ?0)))
+ (= cur (face-attribute 'default :height)))
+ (setq global-text-scale-adjust--increment-factor
+ (1+ global-text-scale-adjust--increment-factor))
+ (global-text-scale-adjust increment))))
(when (characterp key)
(set-transient-map
(let ((map (make-sparse-keymap)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 740fe3e757: Fix global face scaling bug due to rounding.,
Gregory Heytings <=