Function: indent-bars--display-blank-lines

indent-bars--display-blank-lines is a natively compiled function defined in indent-bars.el.

Signature

(indent-bars--display-blank-lines BEG END &optional STYLE SWITCH-AFTER STYLE2)

Documentation

Display appropriate bars over the blank-only lines from BEG..END.

Only called if indent-bars-display-on-blank-lines is non-nil. To be called on complete multi-line blank line regions. BEG should be at the beginning of line for the first line in a contiguous range of blank lines, and END should be at the beginning of the first non-blank line below this range.

It is ambigious how many bars to draw on blank lines, so this uses the maximum depth of the surrounding line indentation, above and below, unless indent-bars-display-on-blank-lines is set to least, in which case the minimum bar depth of such lines is used instead.

Drawing uses indent-bars--draw-line. STYLE, SWITCH-AFTER and STYLE2 are as in indent-bars--draw-line.

Note: blank lines at the very beginning or end of the buffer are not indicated, even if they otherwise would be.

Source Code

;; Defined in /nix/store/zkcdcnmcj3605fj09x584bf58d85brax-emacs-packages-deps/share/emacs/site-lisp/elpa/indent-bars-1.0.1/indent-bars.el
(defun indent-bars--display-blank-lines (beg end &optional style switch-after style2)
  "Display appropriate bars over the blank-only lines from BEG..END.
Only called if `indent-bars-display-on-blank-lines' is non-nil.  To be
called on complete multi-line blank line regions.  BEG should be at the
beginning of line for the first line in a contiguous range of blank
lines, and END should be at the beginning of the first non-blank line
below this range.

It is ambigious how many bars to draw on blank lines, so this uses the
maximum depth of the surrounding line indentation, above and below,
unless `indent-bars-display-on-blank-lines' is set to `least', in which
case the minimum bar depth of such lines is used instead.

Drawing uses `indent-bars--draw-line'.  STYLE, SWITCH-AFTER and STYLE2
are as in `indent-bars--draw-line'.

Note: blank lines at the very beginning or end of the buffer are not
indicated, even if they otherwise would be."
  (save-excursion
    (goto-char (1- beg))
    (forward-line 0)
    (let* ((pm (point-max))
	   (ctxbars (indent-bars--context-bars
		     end (eq indent-bars-display-on-blank-lines 'least)))
	   (ctxskip (when (consp ctxbars)
		      (prog1 (cdr ctxbars) (setq ctxbars (car ctxbars))))))
      (when (> ctxbars 0)
	(goto-char beg)
	(while (< (point) end) ;note: end extends 1 char beyond blank line range
	  (let* ((bp (line-beginning-position))
		 (ep (line-end-position)))
	    (unless (= ep pm)
	      (indent-bars--draw-line style ctxbars bp ep ctxskip 'invent
				      switch-after style2))
	    (beginning-of-line 2))))
    nil)))