Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
XiaoGeMa opened this issue Jun 17, 2018 · 1 comment
Open
Labels

Comments

@XiaoGeMa
Copy link

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>>
@duianto
Copy link

duianto commented May 28, 2020

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)))))))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants