mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.2933: when 'clipboard' is "unnamed" zp does not work correctly
Problem: When 'clipboard' is "unnamed" zp and zP do not work correctly. Solution: Pass -1 to str_to_reg() and fix computing the character width instead of using the byte length. (Christian Brabandt, closes #8301, closes #8317)
This commit is contained in:
@@ -2090,7 +2090,7 @@ clip_yank_selection(
|
|||||||
|
|
||||||
clip_free_selection(cbd);
|
clip_free_selection(cbd);
|
||||||
|
|
||||||
str_to_reg(y_ptr, type, str, len, 0L, FALSE);
|
str_to_reg(y_ptr, type, str, len, -1, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -4308,7 +4308,6 @@ mb_charlen(char_u *str)
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined(FEAT_SPELL) || defined(FEAT_EVAL)) || defined(PROTO)
|
|
||||||
/*
|
/*
|
||||||
* Like mb_charlen() but for a string with specified length.
|
* Like mb_charlen() but for a string with specified length.
|
||||||
*/
|
*/
|
||||||
@@ -4323,7 +4322,6 @@ mb_charlen_len(char_u *str, int len)
|
|||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to un-escape a multi-byte character.
|
* Try to un-escape a multi-byte character.
|
||||||
|
@@ -2836,6 +2836,7 @@ str_to_reg(
|
|||||||
char_u **ss;
|
char_u **ss;
|
||||||
char_u **pp;
|
char_u **pp;
|
||||||
long maxlen;
|
long maxlen;
|
||||||
|
int charlen;
|
||||||
|
|
||||||
if (y_ptr->y_array == NULL) // NULL means empty register
|
if (y_ptr->y_array == NULL) // NULL means empty register
|
||||||
y_ptr->y_size = 0;
|
y_ptr->y_size = 0;
|
||||||
@@ -2894,22 +2895,26 @@ str_to_reg(
|
|||||||
{
|
{
|
||||||
for (ss = (char_u **) str; *ss != NULL; ++ss, ++lnum)
|
for (ss = (char_u **) str; *ss != NULL; ++ss, ++lnum)
|
||||||
{
|
{
|
||||||
|
charlen = MB_CHARLEN(*ss);
|
||||||
i = (long)STRLEN(*ss);
|
i = (long)STRLEN(*ss);
|
||||||
pp[lnum] = vim_strnsave(*ss, i);
|
pp[lnum] = vim_strnsave(*ss, i);
|
||||||
if (i > maxlen)
|
if (charlen > maxlen)
|
||||||
maxlen = i;
|
maxlen = charlen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (start = 0; start < len + extraline; start += i + 1)
|
for (start = 0; start < len + extraline; start += i + 1)
|
||||||
{
|
{
|
||||||
|
charlen = 0;
|
||||||
for (i = start; i < len; ++i) // find the end of the line
|
for (i = start; i < len; ++i) // find the end of the line
|
||||||
if (str[i] == '\n')
|
if (str[i] == '\n')
|
||||||
break;
|
break;
|
||||||
i -= start; // i is now length of line
|
i -= start; // i is now length of line
|
||||||
if (i > maxlen)
|
if (start < len)
|
||||||
maxlen = i;
|
charlen = mb_charlen_len(str + start, i);
|
||||||
|
if (charlen > maxlen)
|
||||||
|
maxlen = charlen;
|
||||||
if (append)
|
if (append)
|
||||||
{
|
{
|
||||||
--lnum;
|
--lnum;
|
||||||
|
@@ -750,6 +750,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 */
|
||||||
|
/**/
|
||||||
|
2933,
|
||||||
/**/
|
/**/
|
||||||
2932,
|
2932,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user