Function: eca-table--display-width

eca-table--display-width is a natively compiled function defined in eca-table.el.

Signature

(eca-table--display-width STR)

Documentation

Return the display width of STR as rendered by the chat mode.

Uses font-lock with markdown-hide-markup to determine which characters are invisible, then sums the widths of visible ones.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-table.el
(defun eca-table--display-width (str)
  "Return the display width of STR as rendered by the chat mode.
Uses font-lock with `markdown-hide-markup' to determine which
characters are invisible, then sums the widths of visible ones."
  (with-current-buffer (eca-table--get-fontlock-buffer)
    (erase-buffer)
    (insert str)
    (font-lock-ensure)
    (let ((width 0))
      (dotimes (i (- (point-max) (point-min)))
        (let ((pos (+ (point-min) i)))
          (unless (invisible-p pos)
            (setq width (+ width (char-width (char-after pos)))))))
      width)))