Francisco Lopes wrote:

> Bram Moolenaar wrote:
> > 
> > It appears the problem is that pum_first and pum_height are out of sync.
> > pum_first is corrected only after the code that causes a redraw for the
> > preview window.
> > 
> > Please verify the patch below also fixes the crash.  It's better in the
> > sense that it corrects pum_first, instead of displaying the wrong items
> > and then aborting when going past the end of pum_array.
> > 
> > *** ../vim-7.4.052/src/popupmnu.c   2011-08-17 18:04:28.000000000 +0200
> > --- src/popupmnu.c  2013-11-02 04:01:06.000000000 +0100
> > ***************
> > *** 282,287 ****
> > --- 282,291 ----
> >       int           round;
> >       int           n;
> >   
> > +     /* Never display more than we have */
> > +     if (pum_first > pum_size - pum_height)
> > +   pum_first = pum_size - pum_height;
> > + 
> >       if (pum_scrollbar)
> >       {
> >     thumb_heigth = pum_height * pum_height / pum_size;
> > ***************
> > *** 672,681 ****
> >   #endif
> >       }
> >   
> > -     /* Never display more than we have */
> > -     if (pum_first > pum_size - pum_height)
> > -   pum_first = pum_size - pum_height;
> > - 
> >       if (!resized)
> >     pum_redraw();
> >   
> > --- 676,681 ----
> 
> Yes this patch also fixes the issue, but, I'd just like to warn that,
> in my opinion, the statement assigning to idx continues not making
> sense. The loop goes up to a maximum value, and the internal loop
> index shouldn't be beyond this, so, idx only makes sense when
> pum_first is zero, hence only when idx == i.

You are forgetting about the situation where pum_size > pum_height.

-- 
"I love deadlines.  I especially like the whooshing sound they
make as they go flying by."
                         -- Douglas Adams

 /// Bram Moolenaar -- [email protected] -- 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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui