summaryrefslogtreecommitdiff
path: root/src/charset.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-03-10 14:46:26 +0100
committerBram Moolenaar <Bram@vim.org>2010-03-10 14:46:26 +0100
commit37d619f896bb425a0e82199977ab9069434c9b1d (patch)
tree55436a1d7087827e0728afe130fc717fc44dc69c /src/charset.c
parentbe678f86d13a4c613daf74192f177590bc45c2c4 (diff)
downloadvim-git-37d619f896bb425a0e82199977ab9069434c9b1d.tar.gz
updated for version 7.2.391v7.2.391
Problem: Internal alloc(0) error when doing "CTRL-V $ c". (Martti Kuparinen) Solution: Fix computations in getvcol(). (partly by Lech Lorens)
Diffstat (limited to 'src/charset.c')
-rw-r--r--src/charset.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/charset.c b/src/charset.c
index 5b0e71c8a..ef162e4a4 100644
--- 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;