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

69869Re: bug with mappings run from "(insert) Visual" mode

Expand Messages
  • Bram Moolenaar
    May 20, 2013
      Ein Brown wrote:

      > Hi, I seem to have run into a bug with mappings run inside "(insert)
      > Visual" mode.
      >
      > example here:
      > http://stackoverflow.com/a/16230661/1176650

      So this is about:

      vnoremap <A-[> <C-G>ugv

      You must understand that this is written to be executed in Visual mode.
      So Vim does CTRL-G, then sees the "u", deletes the selected text, then
      continues as if it exits Visual mode, thus is now in Normal mode.

      I can see this is not what you expect. I think this change will fix it:

      --- ../../mercurial/vim73/src/normal.c 2013-05-06 04:21:38.000000000 +0200
      +++ normal.c 2013-05-20 21:11:55.000000000 +0200
      @@ -701,6 +701,7 @@
      else
      c = 'c';
      msg_nowait = TRUE; /* don't delay going to insert mode */
      + old_mapped_len = 0; /* do go to Insert mode */
      }
      #endif


      I wonder if this causes a problem for someone who relies on the old
      behavior...?

      --
      <Beeth> Girls are like internet domain names,
      the ones I like are already taken.
      <honx> Well, you can stil get one from a strange country :-P

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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 2 messages in this topic