Fix: pasting the dot-register (last inserted text) verbally pastes symbolic keys - #1375
Fix: pasting the dot-register (last inserted text) verbally pastes symbolic keys#1375jorbakk wants to merge 2 commits into
Conversation
…mbolic keys Instead of pasting the contents of the dot-register, mode is switched to insert and it is replayed like a macro.
There was a problem hiding this comment.
I agree that this is an issue but I don't think this is the correct way to fix it. Here is an example of something which should work but doesn't with this patch:
iabc def<Escape>vb".p
what should be in the window is:
abc abc def
without this patch we get:
abc abc def<Escape>
with this patch we get:
abc
(also note the space after the c.)
I assume that at some point vis_repeat() also reads from the VIS_REG_DOT register but it must do something else with the contents. We will need to do something similar here.
|
Here's an update of the patch that should cover all use cases of putting the dot-register:
In contrast to Please also note that generally replaying a macro does not work from visual mode and probably also should not, though this is stated in the docs (vim doesn't do that either). Therefore the following steps to replay the dot-register macro are necessary:
I left some comments in the changes for each of the steps (which don't need to be kept eventually). |
When pasting the dot-register, symbolic keys like
<Escape>, <Enter>, <Left>, <Right>, ... are inserted as text and not executed. Thus, the text<Escape>is always appended, and if multiple lines were inserted or a cursor key was used while inserting, the corresponding text for these keys is inserted. For example, when inserting two lines and then pasting the last insert with".p, the pasted text looks like:Instead of pasting the contents of the dot-register verbally, this fix switches to insert mode and then replays the content of the dot-register like a macro. The resulting text from the example then looks like: