Function: ghostel--top-pad-set

ghostel--top-pad-set is a natively compiled function defined in ghostel.el.

Signature

(ghostel--top-pad-set PAD)

Documentation

Pad PAD pixels above the first row; 0 removes the pad.

The pad is a PAD-pixel display line: a newline in a tiny face whose line-height sets the height. A line-height on the first row's own newline would not do: redisplay drops it when the row fills the window width, and the renderer rewrites that newline.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--top-pad-set (pad)
  "Pad PAD pixels above the first row; 0 removes the pad.
The pad is a PAD-pixel display line: a newline in a tiny face whose
`line-height' sets the height.  A `line-height' on the first row's own
newline would not do: redisplay drops it when the row fills the window
width, and the renderer rewrites that newline."
  (unless (eql pad ghostel--top-pad)
    (if (= pad 0)
        (delete-overlay ghostel--top-pad-overlay)
      (let ((ov (or ghostel--top-pad-overlay
                    (setq ghostel--top-pad-overlay
                          (make-overlay (point-min) (point-min))))))
        (unless (overlay-buffer ov)
          (move-overlay ov (point-min) (point-min)))
        (overlay-put ov 'before-string
                     (propertize "\n" 'face '(:inherit default :height 10)
                                 'line-height pad))))
    (setq ghostel--top-pad pad)))