Function: eww--limit-string-pixelwise

eww--limit-string-pixelwise is a byte-compiled function defined in eww.el.gz.

Signature

(eww--limit-string-pixelwise STRING PIXELS)

Source Code

;; Defined in /usr/src/emacs/lisp/net/eww.el.gz
(defun eww--limit-string-pixelwise (string pixels)
  (if (not pixels)
      string
    (with-temp-buffer
      (insert string)
      (if (< (eww--pixel-column) pixels)
	  string
	;; Iterate to find appropriate length.
	(while (and (> (eww--pixel-column) pixels)
		    (not (bobp)))
	  (forward-char -1))
	;; Return at least one character.
	(buffer-substring (point-min) (max (point)
					   (1+ (point-min))))))))