Function: majutsu-interactive--hunk-lines

majutsu-interactive--hunk-lines is a natively compiled function defined in majutsu-interactive.el.

Signature

(majutsu-interactive--hunk-lines SECTION)

Documentation

Return hunk body lines from SECTION with positions and types.

Each entry is (TEXT TYPE BOL EOL).

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-interactive.el
(defun majutsu-interactive--hunk-lines (section)
  "Return hunk body lines from SECTION with positions and types.
Each entry is (TEXT TYPE BOL EOL)."
  (let ((lines nil)
        (start (oref section content))
        (end (oref section end)))
    (save-excursion
      (goto-char start)
      (while (< (point) end)
        (let* ((bol (line-beginning-position))
               (eol (min (1+ (line-end-position)) end))
               (text (buffer-substring-no-properties bol eol))
               (type (pcase (and (> (length text) 0) (aref text 0))
                       (?\s 'context)
                       (?- 'removed)
                       (?+ 'added)
                       (?\\ 'meta)
                       (_ 'meta))))
          (push (list text type bol eol) lines))
        (forward-line 1)))
    (nreverse lines)))