Skip to content

Commit d717732

Browse files
committed
Add Rendering block to ghostel-debug-info, break out font/line-spacing
The Size sync block conflated `default-line-height' (font + spacing) into a single number, so a face report couldn't tell us which knob caused a row-metric mismatch. Split the breakdown: - Size sync now shows `default-font' and `default-line' separately, with a hint when font ≠ frame char or when line-spacing inflates the line height. Adds `Bottom gap' = `body − term-rows × dlh' so the report literally shows the unused pixels. - New `--- Rendering ---' section captures `Default face' (family, :height, :weight), `Resolved font' (the font Emacs actually picks — flags fallback / remap if it differs from the frame font), `line-spacing' broken into buffer-local / default-value / frame parameter, and `face-remapping-alist' so popup themes that remap the default face show up directly. Future #192-class reports — fonts, line-spacing, fallback fonts, themes that bump default :height — should now be diagnosable from a single `M-x ghostel-debug-info' capture instead of a back-and-forth.
1 parent ce966eb commit d717732

1 file changed

Lines changed: 55 additions & 5 deletions

File tree

lisp/ghostel-debug.el

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -587,25 +587,34 @@ ghostel settings into *ghostel-debug* for pasting into bug reports."
587587
(window-screen-lines)))
588588
(body-rows (window-body-height win))
589589
(frame-ch (frame-char-height))
590+
(default-fh (with-selected-window win
591+
(default-font-height)))
590592
(default-lh (with-selected-window win
591593
(default-line-height)))
592594
(target-rows (floor screen-lines))
595+
(rendered-px (* term-rows default-lh))
596+
(gap-px (- cur-body-px rendered-px))
593597
(rows-match (eql target-rows term-rows))
594598
(px-match (eql cur-body-px old-body-px)))
595599
(insert (format "screen-lines: %.3f → target %d (term=%s) %s\n"
596600
screen-lines target-rows term-rows
597601
(if rows-match "[in sync]" "[MISMATCH]")))
598602
(insert (format "Body rows (frame): %d (window-body-height — frame chars)\n"
599603
body-rows))
600-
(insert (format "Line height: frame=%d px default-face=%d px%s\n"
601-
frame-ch default-lh
602-
(if (eql frame-ch default-lh) ""
603-
" [face-remap or theme bumps height]")))
604+
(insert (format "Line height: frame=%d px default-font=%d px default-line=%d px%s\n"
605+
frame-ch default-fh default-lh
606+
(cond ((not (eql frame-ch default-fh))
607+
" [font ≠ frame: face-remap or :height]")
608+
((not (eql default-fh default-lh))
609+
" [extra from line-spacing]")
610+
(t ""))))
604611
(insert (format "Body pixels: cur=%d recorded=%d %s\n"
605612
cur-body-px old-body-px
606613
(if px-match "" "[redisplay pending]")))
607614
(insert (format "Window pixels: cur=%d recorded=%d\n"
608615
cur-total-px old-total-px))
616+
(insert (format "Bottom gap: %d px (%d rendered − %d body)\n"
617+
gap-px rendered-px cur-body-px))
609618
(cond
610619
(rows-match
611620
(insert "Diagnosis: in sync\n"))
@@ -614,7 +623,48 @@ ghostel settings into *ghostel-debug* for pasting into bug reports."
614623
(insert " ghostel didn't reconcile (#192)\n"))
615624
(t
616625
(insert "Diagnosis: pending redisplay; hooks will fire\n")
617-
(insert " on next paint\n"))))))))
626+
(insert " on next paint\n"))))
627+
;; Rendering — font / line-spacing / face-remap.
628+
;; Most #192-class follow-ups so far have been about
629+
;; line-spacing or face-remap silently changing the row
630+
;; metric. Surface the live values so a report tells
631+
;; us in one capture which knob is responsible.
632+
(insert "\n--- Rendering ---\n")
633+
(let* ((face-family
634+
(with-current-buffer ghostel-buf
635+
(face-attribute 'default :family nil 'default)))
636+
(face-height
637+
(with-current-buffer ghostel-buf
638+
(face-attribute 'default :height nil 'default)))
639+
(face-weight
640+
(with-current-buffer ghostel-buf
641+
(face-attribute 'default :weight nil 'default)))
642+
(resolved-font
643+
(with-selected-window win (face-font 'default)))
644+
(frame-font (frame-parameter nil 'font))
645+
(lsp-buf (with-current-buffer ghostel-buf
646+
(and (local-variable-p 'line-spacing)
647+
line-spacing)))
648+
(lsp-default (default-value 'line-spacing))
649+
(lsp-frame (frame-parameter nil 'line-spacing))
650+
(remap (with-current-buffer ghostel-buf
651+
face-remapping-alist)))
652+
(insert (format "Default face: %s %S %s\n"
653+
face-family face-height face-weight))
654+
(insert (format "Resolved font: %s\n" resolved-font))
655+
(insert (format "Frame font: %s%s\n"
656+
frame-font
657+
(if (and (stringp resolved-font)
658+
(stringp frame-font)
659+
(not (string= resolved-font frame-font)))
660+
" [resolved differs — fallback or remap]"
661+
"")))
662+
(insert (format "line-spacing: buf=%S default-value=%S frame=%S\n"
663+
lsp-buf lsp-default lsp-frame))
664+
(insert (format "face-remapping: %s\n"
665+
(if remap
666+
(format "%S" remap)
667+
"(none)"))))))))
618668
;; Non-default ghostel settings
619669
(insert "\n--- Non-default ghostel settings ---\n")
620670
(let (changed)

0 commit comments

Comments
 (0)