Hi, Kana and Bram
2012/4/8(Sun) 12:00:51 UTC+9 Kana Natsuno:
> According to the :help i_CTRL-O --
>
> > The CTRL-O command takes you to Normal mode. If you then use a command
> > enter
> > Insert mode again it doesn't nest. Thus when typing "a<C-O>a" and then
> > <Esc>
> > takes you back to Normal mode, you do not need to type <Esc> twice.
>
> There are several commands to enter Insert mode, for example, a, i, S,
> cc.
> So I think that Insert mode will never be nested even if such commands
> are
> used after <C-o>. But Vim seems not to behave so. For example:
>
> $ vim -u NONE -N -e -s -c 'execute "normal!" "ifoo\<C-o>abar
> \<Esc>Fb" | verbose echo getline(1, "$") line(".") col(".") | qall!'
> ['foobar'] 1 4
>
> $ vim -u NONE -N -e -s -c 'execute "normal!" "ifoo\<C-o>ccbar
> \<Esc>Fb" | verbose echo getline(1, "$") line(".") col(".") | qall!'
> ['barFb'] 1 5
>
> $ vim -u NONE -N -e -s -c 'execute "normal!" "ifoo\<C-o>Sbar
> \<Esc>Fb" | verbose echo getline(1, "$") line(".") col(".") | qall!'
> ['barFb'] 1 5
>
> <C-o>a works as documented. But both <C-o>cc and <C-o>S don't work as
> documented. They behave as if Insert mode is nested.
>
> Furthermode, <C-o>cc and <C-o>S work as documented if they are
> interactively
> typed by user. The "nested" behavior only happens if <C-o>cc and <C-
> o>S are
> executed via :normal or :map.
I fixed this. But It may be broke below comment's behavior...
(normal.c : 2019~)
/* This is a new edit command, not a restart. Need to
* remember it to make 'insertmode' work with mappings for
* Visual mode. But do this only once and not when typed and
* 'insertmode' isn't set. */
What do you think?
Regards,
--
Hirohito Higashi
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff -r 161d01cbb165 src/normal.c
--- a/src/normal.c Fri Apr 13 23:04:47 2012 +0200
+++ b/src/normal.c Thu Apr 19 01:11:21 2012 +0900
@@ -2020,7 +2020,7 @@
* remember it to make 'insertmode' work with mappings for
* Visual mode. But do this only once and not when typed and
* 'insertmode' isn't set. */
- if (p_im || !KeyTyped)
+ if (p_im)
restart_edit_save = restart_edit;
else
restart_edit_save = 0;