char_u **ss;
char_u **pp;
long maxlen;
- int charlen;
if (y_ptr->y_array == NULL) // NULL means empty register
y_ptr->y_size = 0;
{
for (ss = (char_u **) str; *ss != NULL; ++ss, ++lnum)
{
- charlen = MB_CHARLEN(*ss);
- i = (long)STRLEN(*ss);
- pp[lnum] = vim_strnsave(*ss, i);
- if (charlen > maxlen)
- maxlen = charlen;
+ pp[lnum] = vim_strsave(*ss);
+ if (type == MBLOCK)
+ {
+ int charlen = mb_string2cells(*ss, -1);
+
+ if (charlen > maxlen)
+ maxlen = charlen;
+ }
}
}
else
{
for (start = 0; start < len + extraline; start += i + 1)
{
- charlen = 0;
+ int charlen = 0;
+
for (i = start; i < len; ++i) // find the end of the line
{
if (str[i] == '\n')
break;
- charlen += mb_ptr2cells_len(str + i, len - i);
+ if (type == MBLOCK)
+ charlen += mb_ptr2cells_len(str + i, len - i);
}
i -= start; // i is now length of line
if (charlen > maxlen)