Skip to content

Commit

Permalink
updated for version 7.2.391
Browse files Browse the repository at this point in the history
Problem:    Internal alloc(0) error when doing "CTRL-V $ c". (Martti Kuparinen)
Solution:   Fix computations in getvcol(). (partly by Lech Lorens)
  • Loading branch information
Bram Moolenaar committed Mar 10, 2010
1 parent 1c3a921 commit 622d45c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
9 changes: 6 additions & 3 deletions src/charset.c
Expand Up @@ -1255,7 +1255,10 @@ getvcol(wp, pos, start, cursor, end)


vcol = 0; vcol = 0;
ptr = ml_get_buf(wp->w_buffer, pos->lnum, FALSE); 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. * This function is used very often, do some speed optimizations.
Expand Down Expand Up @@ -1313,7 +1316,7 @@ getvcol(wp, pos, start, cursor, end)
incr = CHARSIZE(c); incr = CHARSIZE(c);
} }


if (ptr >= posptr) /* character at pos->col */ if (posptr != NULL && ptr >= posptr) /* character at pos->col */
break; break;


vcol += incr; vcol += incr;
Expand All @@ -1334,7 +1337,7 @@ getvcol(wp, pos, start, cursor, end)
break; break;
} }


if (ptr >= posptr) /* character at pos->col */ if (posptr != NULL && ptr >= posptr) /* character at pos->col */
break; break;


vcol += incr; vcol += incr;
Expand Down
12 changes: 6 additions & 6 deletions src/memline.c
Expand Up @@ -2113,12 +2113,12 @@ ml_get_buf(buf, lnum, will_change)
if (buf->b_ml.ml_mfp == NULL) /* there are no lines */ if (buf->b_ml.ml_mfp == NULL) /* there are no lines */
return (char_u *)""; return (char_u *)"";


/* /*
* See if it is the same line as requested last time. * See if it is the same line as requested last time.
* Otherwise may need to flush last used line. * Otherwise may need to flush last used line.
* Don't use the last used line when 'swapfile' is reset, need to load all * Don't use the last used line when 'swapfile' is reset, need to load all
* blocks. * blocks.
*/ */
if (buf->b_ml.ml_line_lnum != lnum || mf_dont_release) if (buf->b_ml.ml_line_lnum != lnum || mf_dont_release)
{ {
ml_flush_line(buf); ml_flush_line(buf);
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -681,6 +681,8 @@ static char *(features[]) =


static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
391,
/**/ /**/
390, 390,
/**/ /**/
Expand Down

0 comments on commit 622d45c

Please sign in to comment.