mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.0.0250: virtcol() does not work well for multi-byte characters
Problem: When virtcol() gets a column that is not the first byte of a multi-byte character the result is unpredictable. (Christian Ludwig) Solution: Correct the column to the first byte of a multi-byte character. Change the utf-8 test to new style.
This commit is contained in:
@@ -1296,7 +1296,14 @@ getvcol(
|
||||
if (pos->col == MAXCOL)
|
||||
posptr = NULL; /* continue until the NUL */
|
||||
else
|
||||
{
|
||||
posptr = ptr + pos->col;
|
||||
#ifdef FEAT_MBYTE
|
||||
if (has_mbyte)
|
||||
/* always start on the first byte */
|
||||
posptr -= (*mb_head_off)(line, posptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* This function is used very often, do some speed optimizations.
|
||||
|
Reference in New Issue
Block a user