Mercurial > vim
diff src/charset.c @ 2108:3cdf2a653e00 v7.2.391
updated for version 7.2.391
Problem: Internal alloc(0) error when doing "CTRL-V $ c". (Martti Kuparinen)
Solution: Fix computations in getvcol(). (partly by Lech Lorens)
author | Bram Moolenaar <bram@zimbu.org> |
---|---|
date | Wed, 10 Mar 2010 14:46:26 +0100 |
parents | fd24e02210c9 |
children | 01e4b4d37842 |
line wrap: on
line diff
--- a/src/charset.c +++ b/src/charset.c @@ -1255,7 +1255,10 @@ getvcol(wp, pos, start, cursor, end) vcol = 0; ptr = ml_get_buf(wp->w_buffer, pos->lnum, FALSE); - posptr = ptr + pos->col; + if (pos->col == MAXCOL) + posptr = NULL; /* continue until the NUL */ + else + posptr = ptr + pos->col; /* * This function is used very often, do some speed optimizations. @@ -1313,7 +1316,7 @@ getvcol(wp, pos, start, cursor, end) incr = CHARSIZE(c); } - if (ptr >= posptr) /* character at pos->col */ + if (posptr != NULL && ptr >= posptr) /* character at pos->col */ break; vcol += incr; @@ -1334,7 +1337,7 @@ getvcol(wp, pos, start, cursor, end) break; } - if (ptr >= posptr) /* character at pos->col */ + if (posptr != NULL && ptr >= posptr) /* character at pos->col */ break; vcol += incr;