Function: gnus-correct-substring

gnus-correct-substring is a byte-compiled function defined in gnus-spec.el.gz.

Signature

(gnus-correct-substring STRING START &optional END)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-spec.el.gz
(defun gnus-correct-substring (string start &optional end)
  (let ((wstart 0)
	(wend 0)
	(wseek 0)
	(seek 0)
	(length (length string))
	(string (concat string "\0")))
    ;; Find the start position.
    (while (and (< seek length)
		(< wseek start))
      (cl-incf wseek (char-width (aref string seek)))
      (cl-incf seek))
    (setq wstart seek)
    ;; Find the end position.
    (while (and (<= seek length)
		(or (not end)
		    (<= wseek end)))
      (cl-incf wseek (char-width (aref string seek)))
      (cl-incf seek))
    (setq wend seek)
    (substring string wstart (1- wend))))