aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-03 05:22:57 -0400
committerCraig Jennings <c@cjennings.net>2026-07-03 05:22:57 -0400
commitefc1b1101a524c6a23bcb8ba828b3cf36c81040c (patch)
tree6f0a9344944e57d223c1288ebd2e5eb1e28bd010 /tests
parent298e24aa8a0fdd88d2ae8ecb514b3e18b2b4bb5b (diff)
downloaddotemacs-efc1b1101a524c6a23bcb8ba828b3cf36c81040c.tar.gz
dotemacs-efc1b1101a524c6a23bcb8ba828b3cf36c81040c.zip
fix(modeline): pin padding height to the frame, not the buffer
The leading modeline space set its height with a display (height 1.15) property, which scales against the buffer's default face. nov-mode's reading view remaps default to 18pt, so there the padding grew to 1.15x that and the bar rendered far taller than normal. The theme's absolute mode-line height couldn't help, since the padding space drives the strip height, not the face. The padding now uses an absolute integer height anchored to the frame's default face, so a buffer that enlarges its own default (nov, text-scale) no longer inflates the bar. Normal buffers are unchanged, and the nov bar matches them.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-modeline-config-segments.el26
1 files changed, 17 insertions, 9 deletions
diff --git a/tests/test-modeline-config-segments.el b/tests/test-modeline-config-segments.el
index 580a7711..0245749d 100644
--- a/tests/test-modeline-config-segments.el
+++ b/tests/test-modeline-config-segments.el
@@ -104,19 +104,27 @@
;; ------------------------------- Padding --------------------------------------
-(ert-deftest test-modeline-config-padding-carries-height-display ()
- "Normal: padding space carries a display height property."
+(ert-deftest test-modeline-config-padding-absolute-height-face ()
+ "Normal: padding space carries a face with an absolute integer :height.
+The height is anchored to the frame default (not the current buffer's
+`default'), so a buffer that remaps `default' larger — nov's reading view,
+`text-scale-mode' — no longer inflates the modeline."
(let ((cj/modeline-height-factor 1.2))
- (let ((s (cj/--modeline-padding)))
+ (let* ((s (cj/--modeline-padding))
+ (face (get-text-property 0 'face s))
+ (h (plist-get face :height)))
(should (stringp s))
- (should (get-text-property 0 'display s)))))
+ (should (integerp h))
+ (should (= h (round (* 1.2 (face-attribute 'default :height nil t))))))))
(ert-deftest test-modeline-config-padding-plain-at-factor-one ()
- "Boundary: factor 1.0 (or nil) yields a plain space, no display prop."
- (let ((cj/modeline-height-factor 1.0))
- (let ((s (cj/--modeline-padding)))
- (should (stringp s))
- (should-not (get-text-property 0 'display s)))))
+ "Boundary: factor 1.0 (or nil) yields a plain space, no height styling."
+ (dolist (factor (list 1.0 nil))
+ (let ((cj/modeline-height-factor factor))
+ (let ((s (cj/--modeline-padding)))
+ (should (stringp s))
+ (should-not (get-text-property 0 'display s))
+ (should-not (get-text-property 0 'face s))))))
(provide 'test-modeline-config-segments)
;;; test-modeline-config-segments.el ends here