anchor.diff:          (ffi-window-set-minibuffer-height (current-window) 0))))
   
   (defun insert (characters &optional (minibuffer (current-minibuffer)))
  -  (setf (input-buffer minibuffer)
  -        (str:insert characters
  -                    (input-cursor-position minibuffer)
  -                    (input-buffer minibuffer)))
  -  (incf (input-cursor-position minibuffer) (length characters))
  +  ;; Set cursor before buffer to ensure cursor is never higher than buffer length.
  +  (let ((old-cursor-position (input-cursor-position minibuffer)))
  +    (incf (input-cursor-position minibuffer) (length characters))
  +    (setf (input-buffer minibuffer)
  +          (str:insert characters
  +                      old-cursor-position
  +                      (input-buffer minibuffer))))
     (state-changed minibuffer)
     (update-display minibuffer))
   
  
positive.code:   "Delete character before cursor."
    (with-accessors ((buffer input-buffer) (cursor input-cursor-position)) minibuffer
      (unless (= cursor 0)
        (setf buffer
              (concatenate 'string
                           (subseq buffer 0 (- cursor 1))
                           (subseq buffer cursor (length buffer))))
        (decf cursor)))
    (state-changed minibuffer)
    (update-display minibuffer))
  
  
negative.code:   "Delete characters from cursor position until the beginning of the word at point."
    (with-accessors ((buffer input-buffer) (cursor input-cursor-position)) minibuffer
      (multiple-value-bind (new-string new-position) (%delete-backwards-word buffer cursor)
        ;; Set cursor before buffer to ensure cursor is never higher than buffer length.
        (setf cursor new-position
              buffer new-string)))
    (state-changed minibuffer)
    (update-display minibuffer))
  
  