vim -u NONE then type in qqafoo<c-o>q<cr><c-o>@q
Expecting the buffer to contain
foo
foo
But instead it contains
foo
fooi
9.1.1566
a
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
There is a question here. If a macro that enters Insert mode is replayed from Replace mode Ctrl-O, should Vim be in Insert mode or Replace mode when the macro finishes?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
This may fix the problem:
diff --git a/src/register.c b/src/register.c index 9eeb88f44..df0b99968 100644 --- a/src/register.c +++ b/src/register.c @@ -787,21 +787,24 @@ do_execreg( static void put_reedit_in_typebuf(int silent) { - char_u buf[3]; + char_u buf[5]; if (restart_edit == NUL) return; + buf[0] = Ctrl_BSL; + buf[1] = Ctrl_N; + if (restart_edit == 'V') { - buf[0] = 'g'; - buf[1] = 'R'; - buf[2] = NUL; + buf[2] = 'g'; + buf[3] = 'R'; + buf[4] = NUL; } else { - buf[0] = restart_edit == 'I' ? 'i' : restart_edit; - buf[1] = NUL; + buf[2] = restart_edit == 'I' ? 'i' : restart_edit; + buf[3] = NUL; } if (ins_typebuf(buf, REMAP_NONE, 0, TRUE, silent) == OK) restart_edit = NUL;
but its final cursor position is not ideal. In the above case, it puts Vim in Replace mode.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Another solution:
diff --git a/src/register.c b/src/register.c index 9eeb88f44..2601bb47b 100644 --- a/src/register.c +++ b/src/register.c @@ -787,22 +787,18 @@ do_execreg( static void put_reedit_in_typebuf(int silent) { - char_u buf[3]; -
if (restart_edit == NUL)
return;
- if (restart_edit == 'V') - {
- buf[0] = 'g'; - buf[1] = 'R'; - buf[2] = NUL;
- } - else - {
- buf[0] = restart_edit == 'I' ? 'i' : restart_edit; - buf[1] = NUL;
- } + char_u buf[] = { K_SPECIAL, KS_EXTRA, KE_COMMAND, + // :startinsert + 's', 't', 'a', 'r', 't', 'i', CAR, NUL }; + if (restart_edit == 'R') + buf[8] = 'r'; // :startreplace + else if (restart_edit == 'V') + buf[8] = 'g'; // :startgreplace + else if (restart_edit == 'A') + buf[8] = '!'; // :startinsert!
if (ins_typebuf(buf, REMAP_NONE, 0, TRUE, silent) == OK)
restart_edit = NUL;
}This doesn't have the cursor position problem, but it puts Vim in Insert mode instead of Replace mode in the Replace mode Ctrl-O case.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()