Function: vi-end-of-insert-state

vi-end-of-insert-state is a byte-compiled function defined in vi.el.gz.

Signature

(vi-end-of-insert-state)

Documentation

Terminate insertion and set up last change command.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/vi.el.gz
(defun vi-end-of-insert-state ()
  "Terminate insertion and set up last change command."
  (if (or (< (point) vi-ins-point)    ;Check if there is any effective change
	  (and (= (point) vi-ins-point) (null vi-ins-prefix-code))
	  (<= vi-ins-repetition 0))
      (vi-goto-command-state t)
    (if (> vi-ins-repetition 1)
	(progn
	  (let ((str (buffer-substring vi-ins-point (point))))
	    (while (> vi-ins-repetition 1)
	      (insert str)
	      (setq vi-ins-repetition (1- vi-ins-repetition))))))
    (vi-set-last-change-command 'vi-first-redo-insertion vi-ins-point (point)
			     overwrite-mode vi-ins-prefix-code)
    (vi-goto-command-state t)))