Skip to content

Macros don't behave as expected when macro register was written with a yank command vs macro recording command #1051

@adlerd

Description

@adlerd

Issue type

  • Bug report

Environment

Emacs version: GNU Emacs 25.3.1 (x86_64-pc-linux-gnu) of 2018-03-29
Operating System: Linux gentoo unstable (May 2018)
Evil version: 1.2.13
Evil installation type: MELPA (via portage)
Graphical/Terminal: terminal (via ssh, tmux, etc.)
Tested in a make emacs session (see CONTRIBUTING.md): No

Reproduction steps

  • Start Emacs
  • :new
  • insert "ifoo^[", without quotes, with ^[ being the actual escape character (via C-v C-[)
  • yank the line into a register, without the newline; i.e., 0"ay$
  • execute this register as a macro (@A)

Expected behavior

"foo" should be inserted after point and we should return to Normal mode

Actual behavior

"foo" is inserted but we remain in Insert mode

Further notes

  • The same repro steps in Vim 8.0 work as expected; probably in a lot of other vi's too
  • I think evil-execute-macro should sanitize its input w/r/t escape just like evil-ex-normal does before passing to execute-kbd-macro; but I'm really not sure what the other consequences of this would be.
  • Here's some alternative repro steps which make this look more like a register bug than a macro bug, in case that seems more problematic, since the problem is that paste+yank isn't idempotent:
    • record a macro into register a using the key sequence qaifooq
    • on a fresh line, paste register a then yank the line back into the same register ("ap0"ay$)
    • execute the macro
    • results: same as above. From a vim user's perspective, the register contents shouldn't have changed; from evil's perspective, they are subtly different.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions