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

[patch] Visual-block-change and cursor-keys

Expand Messages
  • Christian Brabandt
    Bram, when using Visual-block insert or append, you can t use the cursor keys to move the cursor to a different location. This will confuse vim. e.g. consider
    Message 1 of 4 , Sep 28, 2013
    • 0 Attachment
      Bram,
      when using Visual-block insert or append, you can't use the cursor keys
      to move the cursor to a different location. This will confuse vim.

      e.g. consider this block

      aaaaaaa
      bbbbbbb
      ccccccc

      Put the Cursor on the first a, and press
      l<C-V>jjlllI<Right><Right><Space><Space>

      The result will look like this:

      aaa aaaa
      baabbbbbb
      caacccccc

      While the result should look like this

      aaa aaaa
      bbb bbbb
      ccc cccc

      Attached patch fixes it. It is a little bit fragile, because it depends
      on the '[ mark being set correctly, but it seems to work pretty well. If
      some plugin messes with this mark in Visual-block mode, it will probably
      not be worse then the current situation, so this should be ok.

      BTW: I tried to make a new test case for this, but failed, because you
      can't use <C-O> in Visual-block Insert/Append mode (this should probably
      also be fixed sometimes, this is pretty obvious, since the op_change()
      function doesn't care about the return value of the edit() function) and
      using the raw terminal keys e.g. <ESC>OC for right are taken literally.

      Disclaimer, this problem has first been mentioned at stackoverflow:
      http://stackoverflow.com/questions/19030928


      regards,
      Christian
      --

      --
      --
      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.
    • Bram Moolenaar
      ... I suppose so. Or repeating the insert should be omitted. ... Can t you just use the example you gave above? No CTRL-O there. -- Eight Megabytes And
      Message 2 of 4 , Sep 28, 2013
      • 0 Attachment
        Christian Brabandt wrote:

        > Bram,
        > when using Visual-block insert or append, you can't use the cursor keys
        > to move the cursor to a different location. This will confuse vim.
        >
        > e.g. consider this block
        >
        > aaaaaaa
        > bbbbbbb
        > ccccccc
        >
        > Put the Cursor on the first a, and press
        > l<C-V>jjlllI<Right><Right><Space><Space>
        >
        > The result will look like this:
        >
        > aaa aaaa
        > baabbbbbb
        > caacccccc
        >
        > While the result should look like this
        >
        > aaa aaaa
        > bbb bbbb
        > ccc cccc

        I suppose so. Or repeating the insert should be omitted.

        > Attached patch fixes it. It is a little bit fragile, because it depends
        > on the '[ mark being set correctly, but it seems to work pretty well. If
        > some plugin messes with this mark in Visual-block mode, it will probably
        > not be worse then the current situation, so this should be ok.
        >
        > BTW: I tried to make a new test case for this, but failed, because you
        > can't use <C-O> in Visual-block Insert/Append mode (this should probably
        > also be fixed sometimes, this is pretty obvious, since the op_change()
        > function doesn't care about the return value of the edit() function) and
        > using the raw terminal keys e.g. <ESC>OC for right are taken literally.

        Can't you just use the example you gave above? No CTRL-O there.


        --
        Eight Megabytes And Continually Swapping.

        /// 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.
      • Christian Brabandt
        ... Here is an updated patch, including a test. Using :exe one can use the cursor keys just like normal, while if you use Cursor Right literally in the test
        Message 3 of 4 , Sep 29, 2013
        • 0 Attachment
          On Sa, 28 Sep 2013, Bram Moolenaar wrote:

          > Can't you just use the example you gave above? No CTRL-O there.

          Here is an updated patch, including a test. Using :exe one can use the
          cursor keys just like normal, while if you use Cursor Right literally in
          the test file, this will look like ^[OC, which will then be interpreted
          like <esc>, "O" and finally "C" when running the test.

          regards,
          Christian
          --
          Fast jede Frau wäre gern treu. Schwierig ist es bloß, den Mann zu
          finden, dem man treu sein kann.
          -- Marlene Dietrich

          --
          --
          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.
        • Bram Moolenaar
          ... I m glad you found a solution. Thanks! -- ARTHUR: Who are you? TALL KNIGHT: We are the Knights Who Say Ni ! BEDEVERE: No! Not the Knights Who
          Message 4 of 4 , Sep 29, 2013
          • 0 Attachment
            Christian Brabandt wrote:

            > On Sa, 28 Sep 2013, Bram Moolenaar wrote:
            >
            > > Can't you just use the example you gave above? No CTRL-O there.
            >
            > Here is an updated patch, including a test. Using :exe one can use the
            > cursor keys just like normal, while if you use Cursor Right literally in
            > the test file, this will look like ^[OC, which will then be interpreted
            > like <esc>, "O" and finally "C" when running the test.

            I'm glad you found a solution. Thanks!


            --
            ARTHUR: Who are you?
            TALL KNIGHT: We are the Knights Who Say "Ni"!
            BEDEVERE: No! Not the Knights Who Say "Ni"!
            "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

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