syl20bnr/evil-escape

[UPSTREAM] evil-mode with overwrite mode error on pressing key f

Opened this issue ยท 1 comments

Description :octocat:

overwrite mode error on pressing f

Reproduction guide ๐Ÿชฒ

  • Start Emacs
    open a not empty file
    press i into insert mode
    press insert into overwrite mode
    press f

Observed behaviour: ๐Ÿ‘€ ๐Ÿ’”
the two charactors under and after the cursor will be replace by f.
if I press any key otherwise, only one charactor under the cursor will be replaced.
I'm not sure it's a bug or something meaningful I don't understand.

Expected behaviour: โค๏ธ ๐Ÿ˜„
like press other keys.

System Info ๐Ÿ’ป

  • OS: gnu/linux
  • Emacs: 27.0.50
  • Spacemacs: 0.300.0
  • Spacemacs branch: develop (rev. 24ca355b6)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(helm auto-completion better-defaults emacs-lisp git org spell-checking syntax-checking latex python lsp ruby pass
      (erc :variables erc-enable-sasl-auth t erc-server-list
           '(("irc.freenode.net" :port "6697" :ssl t :nick "XXXX" :password)
             ("irc.gitter.im" :port "6697" :ssl t :nick "XXXX" :password)))
      (chinese :variables chinese-enable-youdao-dict t)
      markdown c-c++)
  • System configuration features: XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES THREADS CANNOT_DUMP

Backtrace ๐Ÿพ

<<BACKTRACE IF RELEVANT>>

The first evil escape sequence character seems to be inserted here:

(inserted (evil-escape--insert))

               (inserted (evil-escape--insert))

excluding the insertion in overwrite-mode seems to stop the issue:

               (inserted (unless overwrite-mode (evil-escape--insert)))

This can be tested by evaluating the function with the change:

(defun evil-escape-pre-command-hook ()
  "evil-escape pre-command hook."
  (with-demoted-errors "evil-escape: Error %S"
      (when (evil-escape-p)
        (let* ((modified (buffer-modified-p))
               (inserted (unless overwrite-mode (evil-escape--insert)))
               (fkey (elt evil-escape-key-sequence 0))
               (skey (elt evil-escape-key-sequence 1))
               (evt (read-event nil nil evil-escape-delay)))
          (when inserted (evil-escape--delete))
          (set-buffer-modified-p modified)
          (cond
           ((and (characterp evt)
                 (or (and (equal (this-command-keys) (evil-escape--first-key))
                          (char-equal evt skey))
                     (and evil-escape-unordered-key-sequence
                          (equal (this-command-keys) (evil-escape--second-key))
                          (char-equal evt fkey))))
            (evil-repeat-stop)
            (let ((esc-fun (evil-escape-func)))
              (when esc-fun
                (setq this-command esc-fun)
                (setq this-original-command esc-fun))))
           ((null evt))
           (t (setq unread-command-events
                    (append unread-command-events (list evt)))))))))