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

Patch 7.3.879

Expand Messages
  • Bram Moolenaar
    Patch 7.3.879 Problem: When using an ex command in operator pending mode, using Esc to abort the command still executes the operator. (David Bürgin)
    Message 1 of 5 , Apr 5, 2013
    • 0 Attachment
      Patch 7.3.879
      Problem: When using an ex command in operator pending mode, using Esc to
      abort the command still executes the operator. (David Bürgin)
      Solution: Clear the operator when the ex command fails. (Christian Brabandt)
      Files: src/normal.c


      *** ../vim-7.3.878/src/normal.c 2013-03-16 14:20:45.000000000 +0100
      --- src/normal.c 2013-04-05 16:54:13.000000000 +0200
      ***************
      *** 5418,5423 ****
      --- 5418,5424 ----
      cmdarg_T *cap;
      {
      int old_p_im;
      + int cmd_result;

      #ifdef FEAT_VISUAL
      if (VIsual_active)
      ***************
      *** 5449,5455 ****
      old_p_im = p_im;

      /* get a command line and execute it */
      ! do_cmdline(NULL, getexline, NULL,
      cap->oap->op_type != OP_NOP ? DOCMD_KEEPLINE : 0);

      /* If 'insertmode' changed, enter or exit Insert mode */
      --- 5450,5456 ----
      old_p_im = p_im;

      /* get a command line and execute it */
      ! cmd_result = do_cmdline(NULL, getexline, NULL,
      cap->oap->op_type != OP_NOP ? DOCMD_KEEPLINE : 0);

      /* If 'insertmode' changed, enter or exit Insert mode */
      ***************
      *** 5461,5472 ****
      restart_edit = 0;
      }

      ! /* The start of the operator may have become invalid by the Ex
      ! * command. */
      ! if (cap->oap->op_type != OP_NOP
      && (cap->oap->start.lnum > curbuf->b_ml.ml_line_count
      || cap->oap->start.col >
      ! (colnr_T)STRLEN(ml_get(cap->oap->start.lnum))))
      clearopbeep(cap->oap);
      }
      }
      --- 5462,5478 ----
      restart_edit = 0;
      }

      ! if (cmd_result == FAIL)
      ! /* The Ex command failed, do not execute the operator. */
      ! clearop(cap->oap);
      ! else if (cap->oap->op_type != OP_NOP
      && (cap->oap->start.lnum > curbuf->b_ml.ml_line_count
      || cap->oap->start.col >
      ! (colnr_T)STRLEN(ml_get(cap->oap->start.lnum))
      ! || did_emsg
      ! ))
      ! /* The start of the operator has become invalid by the Ex command.
      ! */
      clearopbeep(cap->oap);
      }
      }
      *** ../vim-7.3.878/src/version.c 2013-04-05 15:39:41.000000000 +0200
      --- src/version.c 2013-04-05 16:56:43.000000000 +0200
      ***************
      *** 730,731 ****
      --- 730,733 ----
      { /* Add new patch number below this line */
      + /**/
      + 879,
      /**/

      --
      ~
      ~
      ~
      ".signature" 4 lines, 50 characters written

      /// 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.
    • glts
      ... I don t know if you saw it but I posted an improved version of this patch -- or so I thought.
      Message 2 of 5 , Apr 6, 2013
      • 0 Attachment
        On Fri, Apr 5, 2013 at 5:43 PM, Bram Moolenaar <Bram@...> wrote:
        >
        > Patch 7.3.879
        > Problem: When using an ex command in operator pending mode, using Esc to
        > abort the command still executes the operator. (David Bürgin)
        > Solution: Clear the operator when the ex command fails. (Christian Brabandt)
        > Files: src/normal.c

        I don't know if you saw it but I posted an improved version of this
        patch -- or so I thought.

        https://groups.google.com/d/msg/vim_dev/rHP4zUKwp2g/y3qVRwRktHMJ

        I pointed to two flaws in the current patch:

        - There is a redundant call to clearop() when cancelling ordinary colon
        commands, e.g. ":call <Esc>".
        - When cmd_result == FAIL and did_emsg == TRUE only clearop() will be
        called when instead clearopbeep() is the intended call. To be sure,
        currently this only happens when there's an out of memory error in
        ex_docmd.c#1055, but it's still not ideal.

        Valid points or am I missing something?

        I'm just asking out of curiosity and out of an interest to learn more.

        Thanks.

        David Bürgin

        --
        --
        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
        ... clearop() is a very simple function, it s not really worth the effort to call it only when needed. ... If did_emsg is TRUE a beep should already have
        Message 3 of 5 , Apr 6, 2013
        • 0 Attachment
          David Bürgin wrote:

          > On Fri, Apr 5, 2013 at 5:43 PM, Bram Moolenaar <Bram@...> wrote:
          > >
          > > Patch 7.3.879
          > > Problem: When using an ex command in operator pending mode, using Esc to
          > > abort the command still executes the operator. (David Bürgin)
          > > Solution: Clear the operator when the ex command fails. (Christian Brabandt)
          > > Files: src/normal.c
          >
          > I don't know if you saw it but I posted an improved version of this
          > patch -- or so I thought.
          >
          > https://groups.google.com/d/msg/vim_dev/rHP4zUKwp2g/y3qVRwRktHMJ
          >
          > I pointed to two flaws in the current patch:
          >
          > - There is a redundant call to clearop() when cancelling ordinary colon
          > commands, e.g. ":call <Esc>".

          clearop() is a very simple function, it's not really worth the effort to
          call it only when needed.

          > - When cmd_result == FAIL and did_emsg == TRUE only clearop() will be
          > called when instead clearopbeep() is the intended call. To be sure,
          > currently this only happens when there's an out of memory error in
          > ex_docmd.c#1055, but it's still not ideal.

          If did_emsg is TRUE a beep should already have happened, if it's needed.
          The other clearopbeep() is when we detect a new error.

          > Valid points or am I missing something?
          >
          > I'm just asking out of curiosity and out of an interest to learn more.

          --
          You cannot have a baby in one month by getting nine women pregnant.

          /// 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.
        • glts
          ... That s fair. If you re interested, I wrote a test for this problem, which passes after patch 7.3.879. I added the test case to the new test94.in that I
          Message 4 of 5 , Apr 6, 2013
          • 0 Attachment
            On Sat, Apr 6, 2013 at 1:58 PM, Bram Moolenaar <Bram@...> wrote:
            >
            > David Bürgin wrote:
            >
            >> On Fri, Apr 5, 2013 at 5:43 PM, Bram Moolenaar <Bram@...> wrote:
            >> >
            >> > Patch 7.3.879
            >> > Problem: When using an ex command in operator pending mode, using Esc to
            >> > abort the command still executes the operator. (David Bürgin)
            >> > Solution: Clear the operator when the ex command fails. (Christian Brabandt)
            >> > Files: src/normal.c
            >>
            >> I don't know if you saw it but I posted an improved version of this
            >> patch -- or so I thought.
            >>
            >> https://groups.google.com/d/msg/vim_dev/rHP4zUKwp2g/y3qVRwRktHMJ
            >>
            >> I pointed to two flaws in the current patch:
            >>
            >> - There is a redundant call to clearop() when cancelling ordinary colon
            >> commands, e.g. ":call <Esc>".
            >
            > clearop() is a very simple function, it's not really worth the effort to
            > call it only when needed.
            >
            >> - When cmd_result == FAIL and did_emsg == TRUE only clearop() will be
            >> called when instead clearopbeep() is the intended call. To be sure,
            >> currently this only happens when there's an out of memory error in
            >> ex_docmd.c#1055, but it's still not ideal.
            >
            > If did_emsg is TRUE a beep should already have happened, if it's needed.
            > The other clearopbeep() is when we detect a new error.

            That's fair.

            If you're interested, I wrote a test for this problem, which passes
            after patch 7.3.879.

            I added the test case to the new test94.in that I proposed in another
            recent message. If you plan to include the test, then please use this
            updated version.

            Thanks.

            --
            --
            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
            ... Thanks, it s always good to test things that were broken. It may break again. -- In a world without fences, who needs Gates and Windows? /// Bram
            Message 5 of 5 , Apr 6, 2013
            • 0 Attachment
              David Bürgin wrote:

              > On Sat, Apr 6, 2013 at 1:58 PM, Bram Moolenaar <Bram@...> wrote:
              > >
              > > David Bürgin wrote:
              > >
              > >> On Fri, Apr 5, 2013 at 5:43 PM, Bram Moolenaar <Bram@...> wrote:
              > >> >
              > >> > Patch 7.3.879
              > >> > Problem: When using an ex command in operator pending mode, using Esc to
              > >> > abort the command still executes the operator. (David Bürgin)
              > >> > Solution: Clear the operator when the ex command fails. (Christian Brabandt)
              > >> > Files: src/normal.c
              > >>
              > >> I don't know if you saw it but I posted an improved version of this
              > >> patch -- or so I thought.
              > >>
              > >> https://groups.google.com/d/msg/vim_dev/rHP4zUKwp2g/y3qVRwRktHMJ
              > >>
              > >> I pointed to two flaws in the current patch:
              > >>
              > >> - There is a redundant call to clearop() when cancelling ordinary colon
              > >> commands, e.g. ":call <Esc>".
              > >
              > > clearop() is a very simple function, it's not really worth the effort to
              > > call it only when needed.
              > >
              > >> - When cmd_result == FAIL and did_emsg == TRUE only clearop() will be
              > >> called when instead clearopbeep() is the intended call. To be sure,
              > >> currently this only happens when there's an out of memory error in
              > >> ex_docmd.c#1055, but it's still not ideal.
              > >
              > > If did_emsg is TRUE a beep should already have happened, if it's needed.
              > > The other clearopbeep() is when we detect a new error.
              >
              > That's fair.
              >
              > If you're interested, I wrote a test for this problem, which passes
              > after patch 7.3.879.
              >
              > I added the test case to the new test94.in that I proposed in another
              > recent message. If you plan to include the test, then please use this
              > updated version.

              Thanks, it's always good to test things that were broken. It may break
              again.

              --
              In a world without fences, who needs Gates and Windows?

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