Function: table--str-index-at-column

table--str-index-at-column is a byte-compiled function defined in table.el.gz.

Signature

(table--str-index-at-column STR COLUMN)

Documentation

Return the character index in STR that corresponds to COLUMN location.

It returns COLUMN unless STR contains some wide characters.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/table.el.gz
(defun table--str-index-at-column (str column)
  "Return the character index in STR that corresponds to COLUMN location.
It returns COLUMN unless STR contains some wide characters."
  (let ((col 0)
	(idx 0)
	(len (length str)))
    (while (and (< col column) (< idx len))
      (setq col (+ col (char-width (aref str idx))))
      (setq idx (1+ idx)))
    (if (< idx len)
	idx
      nil)))