diff options
author | Bram Moolenaar <Bram@vim.org> | 2009-03-11 16:29:20 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2009-03-11 16:29:20 +0000 |
commit | 552c8a567733abb21c0df4bf2174ad5cbab1cdfb (patch) | |
tree | 138d46c97fe60300255bf0ba7d238e7f355b5c0e /src/misc2.c | |
parent | dd310301ecc9d190c043dd6213b13f0f3fc5d4f9 (diff) | |
download | vim-git-552c8a567733abb21c0df4bf2174ad5cbab1cdfb.tar.gz |
updated for version 7.2-139v7.2.139
Diffstat (limited to 'src/misc2.c')
-rw-r--r-- | src/misc2.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/misc2.c b/src/misc2.c index fafe931e6..cfc1bad87 100644 --- 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 } |