Doing `<C-r>:` or `<C-r>q` when `q` is a macro register in insert mode runs the last command instead of printing the command
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
Describe the bug
After running a : command if you do <C-r>: in insertMode you should get the command inserted on the editor, but instead it runs the command. Also after recording a macro if you do <C-r>q where 'q' is the register you saved the macro you should get all used keys printed.
To Reproduce
Steps to reproduce the behavior:
With command:
- With the text
hello world - Run the command
:s/world/Vim - You get
hello Vim - Now press
A<C-R>: - You should get
hello Vims/world/Vim
With macro:
- Press
qqAhello word<BS>ld<Esc>q(here<BS>is the backspace key and<Esc>is the escape key) - Now press
o<C-r>q - You get
hello woldon the next line and go back to normal mode - You should get
hello word<BS>ld<Esc>and still be in insertMode (here the<BS>is actually the four characters and same thing with<Esc>)
Expected behavior
You should get hello word<BS>ld<Esc> and still be in insertMode (here the <BS> is actually the four characters and same thing with <Esc>)
Additional context
I noticed this when fixing the other bug with macros (#4948) that I'm fixing at the moment. I think I know how to fix this one too but I'm going to wait until the PR #4735 gets merged, because if I fix it now it will need to be changed again after that PR is merged.
If you think it is really important to have this before the PR is merged tell me and I'll do it anyway.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the command and macro cases in insert mode, then trace how Ctrl-R handles the command and macro registers. Done means both cases print their contents literally, without executing them, and leave the editor in insert mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100