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)
diff --git a/src/charset.c b/src/charset.c
index 5b0e71c..ef162e4 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1255,7 +1255,10 @@
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 @@
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 @@
break;
}
- if (ptr >= posptr) /* character at pos->col */
+ if (posptr != NULL && ptr >= posptr) /* character at pos->col */
break;
vcol += incr;