Function: org-columns--truncate-below-width
org-columns--truncate-below-width is a byte-compiled function defined
in org-colview.el.gz.
Signature
(org-columns--truncate-below-width STRING WIDTH)
Documentation
Return a substring of STRING no wider than WIDTH.
This substring must start at 0, and must be the longest possible
substring whose string-width does not exceed WIDTH.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-colview.el.gz
(defun org-columns--truncate-below-width (string width)
"Return a substring of STRING no wider than WIDTH.
This substring must start at 0, and must be the longest possible
substring whose `string-width' does not exceed WIDTH."
(declare (side-effect-free t))
(let ((end (min width (length string))) res)
(while (and end (>= end 0))
(let* ((curr (string-width (substring string 0 end)))
(excess (- curr width)))
(if (> excess 0)
(cl-decf end (max 1 (/ excess 2)))
(setq res (substring string 0 end) end nil))))
res))