Loading ...
Sorry, an error occurred while loading the content.

Re: Strange behavior about in Insert mode

Expand Messages
  • Bram Moolenaar
    ... This looks risky. We need to make sure this actually fixes the problem. What is the problem really? Perhaps it s just a documentation unclarity? Keep in
    Message 1 of 3 , Apr 18, 2012
    • 0 Attachment
      Hirohito Higashi wrote:

      > 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?

      This looks risky. We need to make sure this actually fixes the problem.
      What is the problem really? Perhaps it's just a documentation
      unclarity?

      Keep in mind that typing something and executing a mapping or command
      from the command line may work slightly different.


      --
      FATHER: You only killed the bride's father - that's all -
      LAUNCELOT: Oh dear, I didn't really mean to...
      FATHER: Didn't mean to? You put your sword right through his head!
      LAUNCELOT: Gosh - Is he all right?
      "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --
      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
    Your message has been successfully submitted and would be delivered to recipients shortly.