diff options
| author | Eli Zaretskii | 2023-07-21 15:19:02 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2023-07-21 15:19:02 +0300 |
| commit | 845d6561ed07a8a979200a389a39db08dffccdc8 (patch) | |
| tree | 1065ff3e94f00f1e898ee234a3dc679bb0c2d3db | |
| parent | c55e67081e9873a32b6e665e44f3e5a9c301255f (diff) | |
| download | emacs-845d6561ed07a8a979200a389a39db08dffccdc8.tar.gz emacs-845d6561ed07a8a979200a389a39db08dffccdc8.zip | |
Fix Proced display header alignment under 'text-scale-adjust'
* lisp/proced.el (proced-mode): Force the header-line to scale
according to 'text-scale-adjust'.
(proced-header-line): Use width of the header-line's face's
characters as align-to units, not the width of the frame's
default face's font. (Bug#64752)
* src/xdisp.c (calc_pixel_width_or_height): Use font's
average_width or space_width, not max_width, as the correct
measure of the font's width. This is consistent with the rest of
the display engine.
| -rw-r--r-- | lisp/proced.el | 6 | ||||
| -rw-r--r-- | src/xdisp.c | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lisp/proced.el b/lisp/proced.el index 03a7f1bebdf..b3d581a49d1 100644 --- a/lisp/proced.el +++ b/lisp/proced.el | |||
| @@ -776,12 +776,12 @@ of the process. A value of nil indicates that there are no active refinements." | |||
| 776 | (while (string-match "[ \t\n]+" hl pos) | 776 | (while (string-match "[ \t\n]+" hl pos) |
| 777 | (setq pos (match-end 0)) | 777 | (setq pos (match-end 0)) |
| 778 | (put-text-property (match-beginning 0) pos 'display | 778 | (put-text-property (match-beginning 0) pos 'display |
| 779 | `(space :align-to ,(+ pos base)) | 779 | `(space :align-to (,(+ pos base) . width)) |
| 780 | hl))) | 780 | hl))) |
| 781 | (setq hl (replace-regexp-in-string ;; preserve text properties | 781 | (setq hl (replace-regexp-in-string ;; preserve text properties |
| 782 | "\\(%\\)" "\\1\\1" | 782 | "\\(%\\)" "\\1\\1" |
| 783 | hl))) | 783 | hl))) |
| 784 | (list (propertize " " 'display `(space :align-to ,base)) | 784 | (list (propertize " " 'display `(space :align-to (,base . width))) |
| 785 | hl))) | 785 | hl))) |
| 786 | 786 | ||
| 787 | (defun proced-pid-at-point () | 787 | (defun proced-pid-at-point () |
| @@ -894,6 +894,8 @@ normal hook `proced-post-display-hook'. | |||
| 894 | (setq-local font-lock-defaults | 894 | (setq-local font-lock-defaults |
| 895 | '(proced-font-lock-keywords t nil nil beginning-of-line)) | 895 | '(proced-font-lock-keywords t nil nil beginning-of-line)) |
| 896 | (setq-local switch-to-buffer-preserve-window-point nil) | 896 | (setq-local switch-to-buffer-preserve-window-point nil) |
| 897 | ;; So that the heading scales together with the body of the table. | ||
| 898 | (setq-local text-scale-remap-header-line t) | ||
| 897 | (if (and (not proced-auto-update-timer) proced-auto-update-interval) | 899 | (if (and (not proced-auto-update-timer) proced-auto-update-interval) |
| 898 | (setq proced-auto-update-timer | 900 | (setq proced-auto-update-timer |
| 899 | (run-at-time t proced-auto-update-interval | 901 | (run-at-time t proced-auto-update-interval |
diff --git a/src/xdisp.c b/src/xdisp.c index da6e0afa8e1..2eba42e3d90 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -29093,7 +29093,9 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, | |||
| 29093 | /* 'width': the width of FONT. */ | 29093 | /* 'width': the width of FONT. */ |
| 29094 | if (EQ (prop, Qwidth)) | 29094 | if (EQ (prop, Qwidth)) |
| 29095 | return OK_PIXELS (font | 29095 | return OK_PIXELS (font |
| 29096 | ? FONT_WIDTH (font) | 29096 | ? (font->average_width |
| 29097 | ? font->average_width | ||
| 29098 | : font->space_width) | ||
| 29097 | : FRAME_COLUMN_WIDTH (it->f)); | 29099 | : FRAME_COLUMN_WIDTH (it->f)); |
| 29098 | #else | 29100 | #else |
| 29099 | if (EQ (prop, Qheight) || EQ (prop, Qwidth)) | 29101 | if (EQ (prop, Qheight) || EQ (prop, Qwidth)) |