Function: markdown-ts--table-align-cell
markdown-ts--table-align-cell is a byte-compiled function defined in
markdown-ts-mode.el.gz.
Signature
(markdown-ts--table-align-cell TEXT WIDTH ALIGN)
Documentation
Return TEXT padded to WIDTH aligned using ALIGN.
Truncate TEXT wider than WIDTH. It is the caller's responsibility to
ensure text will fit.
ALIGN is one of left center right unspecified.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/markdown-ts-mode.el.gz
(defun markdown-ts--table-align-cell (text width align)
"Return TEXT padded to WIDTH aligned using ALIGN.
Truncate TEXT wider than WIDTH. It is the caller's responsibility to
ensure text will fit.
ALIGN is one of `left' `center' `right' `unspecified'."
(let* ((strlen (length text))
(strlen0 (min width strlen))
(text0 (substring text 0 strlen0))
(pad (- width strlen0)))
(pcase align
('center
(let* ((half-pad (make-string (floor (/ pad 2)) ?\s))
(s (concat
half-pad
text0
half-pad)))
(string-pad
(substring s 0 (min (length s) width))
width)))
('right
(string-pad text width nil 'start))
(_
(string-pad text width)))))