Function: indent-bars--blank-string

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

Signature

(indent-bars--blank-string STYLE OFF NBARS BAR-FROM SKIP &optional WIDTH SWITCH-AFTER STYLE2)

Documentation

Return a blank string with bars displayed, using style STYLE.

OFF is the character offset within the string to draw the first bar, NBARS is the desired number of bars to add, and BAR-FROM is the starting index of the first bar (>=1). If non-nil, WIDTH is the total string width to return, right-padding with space if needed.

If SKIP is provided, it should be a list of bar numbers to skip drawing (with first bar as number 1).

If SWITCH-AFTER is supplied and is an integer, switch from STYLE to STYLE2 after drawing (or skipping) that many bars. If it is t, use STYLE2 for all bars.

Bars are displayed using stipple properties or characters; see indent-bars-prefer-character.

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--blank-string ( style off nbars bar-from skip
				   &optional width switch-after style2)
  "Return a blank string with bars displayed, using style STYLE.
OFF is the character offset within the string to draw the first bar,
NBARS is the desired number of bars to add, and BAR-FROM is the starting
index of the first bar (>=1).  If non-nil, WIDTH is the total string
width to return, right-padding with space if needed.

If SKIP is provided, it should be a list of bar numbers to skip
drawing (with first bar as number 1).

If SWITCH-AFTER is supplied and is an integer, switch from STYLE to
STYLE2 after drawing (or skipping) that many bars.  If it is t, use
STYLE2 for all bars.

Bars are displayed using stipple properties or characters; see
`indent-bars-prefer-character'."
  (concat (propertize (make-string off ?\s) 'face 'indent-bars-invisible-face)
	  (string-join
	   (cl-loop
	    for i from 0 to (1- nbars)
	    for depth = (+ bar-from i)
	    for skip-bar = (memql depth skip)
	    for sty = (if switch-after
			  (if (or (eq switch-after t)
				  (>= i switch-after))
			      style2
			    style)
			style)
	    collect (cond
		     (skip-bar
		      (propertize " " 'face 'indent-bars-invisible-face))
		     (indent-bars--no-stipple
		      (indent-bars--no-stipple-char sty depth))
		     (t (propertize " " 'face (indent-bars--face sty depth)))))
	   (propertize (make-string (1- indent-bars-spacing) ?\s)
		       'face 'indent-bars-invisible-face))
	  (and width
	       (propertize
		(make-string (- width
				(+ off nbars (* (1- nbars)
						(1- indent-bars-spacing))))
			     ?\s)
		'face 'indent-bars-invisible-face))))