Function: flymake--eol-draw-fancy-1

flymake--eol-draw-fancy-1 is a byte-compiled function defined in flymake.el.gz.

Signature

(flymake--eol-draw-fancy-1 TEXT BOXDRAW-FACE LINE-BEG-COL HEIGHT-TO-CLEAR TEXT-BEG-COL TEXT-END-COL)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/flymake.el.gz
(defun flymake--eol-draw-fancy-1 (text boxdraw-face line-beg-col
                                       height-to-clear
                                       text-beg-col
                                       text-end-col)
  (cl-flet ((move (cl)
              (let* ((lep (line-end-position))
                     (target (+ (point) cl))
                     (diff (- target lep)))
                (cond ((> diff 0)
                       (goto-char lep)
                       (insert (make-string diff ? )))
                      (t
                       (goto-char target)))))
            (onward ()
              (let ((rem (forward-line 1)))
                (unless (and (not (eobp)) (zerop rem))
                  (goto-char (point-max))
                  (insert "\n")))))
    (goto-char (point-min))
    (cl-loop
     with fork = (propertize "├" 'face boxdraw-face)
     with pipe = (propertize "│" 'face boxdraw-face)
     with inhibit-field-text-motion = t
     for i from 0
     repeat height-to-clear
     do (move line-beg-col)
     (let ((c (char-before)))
       (delete-char -1)
       (insert
        (propertize
         (cond ;; ((zerop i) "┬")
          ((memq c '(?└ ?├)) fork)
          (t         pipe))
         'face boxdraw-face)))
     (onward))
    (move line-beg-col)
    (delete-char -1)
    (insert (propertize "└" 'face boxdraw-face))
    (insert (propertize (make-string (- text-beg-col line-beg-col 1)
                                     ?─)
                        'face boxdraw-face))
    (insert " ")
    (let ((rect (with-temp-buffer
                  (insert text)
                  (let ((fill-column (- text-end-col text-beg-col)))
                    (fill-paragraph)
                    (forward-line 0)
                    (move fill-column)
                    (extract-rectangle (point-min) (point-max))))))
      (insert-rectangle rect)
      (+ height-to-clear (length rect)))))