James Vega wrote:

> On Sat, Mar 07, 2009 at 04:30:30PM -0500, James Vega wrote:
>> There seems to be an edge case when positioning the cursor and
>> 'virtualedit' is set to all that causes gvim to crash.  This was
>> introduced between 6.4 and 7.0b.
>>
>> It can be reproduced using the attached files as follows:
>>
>>   gvim -u NONE -N -S crash.vim crash.txt
>
> Actually attached this time.
>
> --
> James

My previous patch was only a workaround, but this
new attached patch should be the actual bug fix.

Please review it.

oldcol can be MAXCOL when entering function
check_cursor_col().  Function check_cursor_col()
compares oldcol to MAXCOL _after_ having added
curwin->w_cursor.coladd to it, so as a result it fails
to see that it was MAXCOL.  Attached patch fixes it.

Thanks
-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Index: misc2.c
===================================================================
RCS file: /cvsroot/vim/vim7/src/misc2.c,v
retrieving revision 1.79
diff -c -r1.79 misc2.c
*** misc2.c	24 Feb 2009 03:29:48 -0000	1.79
--- misc2.c	8 Mar 2009 11:59:29 -0000
***************
*** 532,538 ****
      /* If virtual editing is on, we can leave the cursor on the old position,
       * only we must set it to virtual.  But don't do it when at the end of the
       * line. */
!     if (oldcol == MAXCOL)
  	curwin->w_cursor.coladd = 0;
      else if (ve_flags == VE_ALL)
  	curwin->w_cursor.coladd = oldcol - curwin->w_cursor.col;
--- 532,538 ----
      /* If virtual editing is on, we can leave the cursor on the old position,
       * only we must set it to virtual.  But don't do it when at the end of the
       * line. */
!     if (oldcol - curwin->w_cursor.coladd == MAXCOL)
  	curwin->w_cursor.coladd = 0;
      else if (ve_flags == VE_ALL)
  	curwin->w_cursor.coladd = oldcol - curwin->w_cursor.col;

Raspunde prin e-mail lui