Function: eca-chat-inline--wrap-lines
eca-chat-inline--wrap-lines is a natively compiled function defined in
eca-chat-inline.el.
Signature
(eca-chat-inline--wrap-lines WIDTH)
Documentation
Hard-wrap lines longer than WIDTH columns in the current buffer.
Lines are only split, never joined, so code blocks keep their structure. Splits happen at the last whitespace before WIDTH or mid-token when there is none. Invisible chars (hidden markup) count as zero width.
Source Code
;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat-inline.el
(defun eca-chat-inline--wrap-lines (width)
"Hard-wrap lines longer than WIDTH columns in the current buffer.
Lines are only split, never joined, so code blocks keep their
structure. Splits happen at the last whitespace before WIDTH or
mid-token when there is none. Invisible chars (hidden markup)
count as zero width."
(goto-char (point-min))
(let ((col 0)
(break-pos nil))
(while (not (eobp))
(cond
((eq (char-after) ?\n)
(forward-char 1)
(setq col 0 break-pos nil))
((invisible-p (point))
(forward-char 1))
(t
(when (memq (char-after) '(?\s ?\t))
(setq break-pos (point)))
(setq col (1+ col))
(forward-char 1)
(when (and (>= col width)
(not (eobp))
(not (eq (char-after) ?\n)))
(if break-pos
(progn
(goto-char break-pos)
(delete-char 1)
(insert "\n"))
(insert "\n"))
(setq col 0 break-pos nil)))))))