Function: glc-center-ellipsis
glc-center-ellipsis is a byte-compiled function defined in
goto-chg.el.
Signature
(glc-center-ellipsis STR MAXLEN &optional ELLIPSIS)
Documentation
Truncate STRING in the middle to length MAXLEN.
If STRING is max MAXLEN just return the string. Optional third argument is the replacement, which defaults to "...".
Source Code
;; Defined in ~/.emacs.d/elpa/goto-chg-20240407.1110/goto-chg.el
(defun glc-center-ellipsis (str maxlen &optional ellipsis)
"Truncate STRING in the middle to length MAXLEN.
If STRING is max MAXLEN just return the string.
Optional third argument is the replacement, which defaults to \"...\"."
(if (<= (length str) maxlen)
str
;; else
(let* ((lipsis (or ellipsis "..."))
(i (/ (- maxlen (length lipsis)) 2)))
(concat (substring str 0 i)
lipsis
(substring str (- i))))))