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

Re: Custom command completion

Expand Messages
  • danthau@...
    ... Patch 1260 broke it. I submitted it yesterday, but Bram seems to have added some extra sauce to it to make it more robust which ended up doing the
    Message 1 of 3 , Jun 29 7:25 PM
    • 0 Attachment
      On Saturday, June 29, 2013 5:37:44 PM UTC-7, Marcin Szamotulski wrote:
      > Dear vim dev,
      >
      >
      >
      > With the latest vim-7.3.1270 custom command completion is not working.
      >
      > This is a simple test which fails:
      >
      >
      >
      > fun! ComComp(a,b,c)
      >
      > return "aaa\nbbb\nccc"
      >
      > endfun
      >
      > com! -nargs=1 -complete=custom,ComComp Test :echo ':@'
      >
      >
      >
      > Then ":Test ^D" does not show any results.
      >
      >
      >
      > Best regards,
      >
      > Marcin Szamotulski

      Patch 1260 broke it. I submitted it yesterday, but Bram seems to have added some extra sauce to it to make it more robust which ended up doing the opposite. It's a simple fix, see below.

      ---
      src/ex_getln.c | 10 +++++-----
      1 files changed, 5 insertions(+), 5 deletions(-)

      diff --git a/src/ex_getln.c b/src/ex_getln.c
      index 18a708b..bf2c64a 100644
      --- a/src/ex_getln.c
      +++ b/src/ex_getln.c
      @@ -4379,11 +4379,6 @@ set_cmd_context(xp, str, len, col)
      int old_char = NUL;
      char_u *nextcomm;

      - /* Store the string here so that call_user_expand_func() can get to them
      - * easily. */
      - xp->xp_line = str;
      - xp->xp_col = col;
      -
      /*
      * Avoid a UMR warning from Purify, only save the character if it has been
      * written before.
      @@ -4414,6 +4409,11 @@ set_cmd_context(xp, str, len, col)
      while (nextcomm != NULL)
      nextcomm = set_one_cmd_context(xp, nextcomm);

      + /* Store the cmdline/cursor position here so that call_user_expand_func()
      + * can get to them easily. */
      + xp->xp_line = str;
      + xp->xp_col = col;
      +
      str[col] = old_char;
      }

      ---

      --
      --
      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.
    • Marcin Szamotulski
      ... Thanks, this patch indeed solves the problem. Best regards, Marcin -- -- You received this message from the vim_dev maillist. Do not top-post! Type your
      Message 2 of 3 , Jun 29 8:56 PM
      • 0 Attachment
        On 19:25 Sat 29 Jun , danthau@... wrote:
        > On Saturday, June 29, 2013 5:37:44 PM UTC-7, Marcin Szamotulski wrote:
        > > Dear vim dev,
        > >
        > >
        > >
        > > With the latest vim-7.3.1270 custom command completion is not working.
        > >
        > > This is a simple test which fails:
        > >
        > >
        > >
        > > fun! ComComp(a,b,c)
        > >
        > > return "aaa\nbbb\nccc"
        > >
        > > endfun
        > >
        > > com! -nargs=1 -complete=custom,ComComp Test :echo ':@'
        > >
        > >
        > >
        > > Then ":Test ^D" does not show any results.
        > >
        > >
        > >
        > > Best regards,
        > >
        > > Marcin Szamotulski
        >
        > Patch 1260 broke it. I submitted it yesterday, but Bram seems to have added some extra sauce to it to make it more robust which ended up doing the opposite. It's a simple fix, see below.
        >
        > ---
        > src/ex_getln.c | 10 +++++-----
        > 1 files changed, 5 insertions(+), 5 deletions(-)
        >
        > diff --git a/src/ex_getln.c b/src/ex_getln.c
        > index 18a708b..bf2c64a 100644
        > --- a/src/ex_getln.c
        > +++ b/src/ex_getln.c
        > @@ -4379,11 +4379,6 @@ set_cmd_context(xp, str, len, col)
        > int old_char = NUL;
        > char_u *nextcomm;
        >
        > - /* Store the string here so that call_user_expand_func() can get to them
        > - * easily. */
        > - xp->xp_line = str;
        > - xp->xp_col = col;
        > -
        > /*
        > * Avoid a UMR warning from Purify, only save the character if it has been
        > * written before.
        > @@ -4414,6 +4409,11 @@ set_cmd_context(xp, str, len, col)
        > while (nextcomm != NULL)
        > nextcomm = set_one_cmd_context(xp, nextcomm);
        >
        > + /* Store the cmdline/cursor position here so that call_user_expand_func()
        > + * can get to them easily. */
        > + xp->xp_line = str;
        > + xp->xp_col = col;
        > +
        > str[col] = old_char;
        > }

        Thanks, this patch indeed solves the problem.

        Best regards,
        Marcin

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