# HG changeset patch # User vimboss # Date 1236788960 0 # Node ID 72ef7987368de4715599707a85f74a8e6d029c9c # Parent ccc9eda1cfcf918fbd1933bca9db01e246d5ef12 updated for version 7.2-139 diff --git a/src/misc2.c b/src/misc2.c --- a/src/misc2.c +++ b/src/misc2.c @@ -496,7 +496,8 @@ check_cursor_col() { colnr_T len; #ifdef FEAT_VIRTUALEDIT - colnr_T oldcol = curwin->w_cursor.col + curwin->w_cursor.coladd; + colnr_T oldcol = curwin->w_cursor.col; + colnr_T oldcoladd = curwin->w_cursor.col + curwin->w_cursor.coladd; #endif len = (colnr_T)STRLEN(ml_get_curline()); @@ -535,7 +536,13 @@ check_cursor_col() if (oldcol == MAXCOL) curwin->w_cursor.coladd = 0; else if (ve_flags == VE_ALL) - curwin->w_cursor.coladd = oldcol - curwin->w_cursor.col; + { + if (oldcoladd > curwin->w_cursor.col) + curwin->w_cursor.coladd = oldcoladd - curwin->w_cursor.col; + else + /* avoid weird number when there is a miscalculation or overflow */ + curwin->w_cursor.coladd = 0; + } #endif } diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -677,6 +677,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 139, +/**/ 138, /**/ 137,