Patch 8.2.2933
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)
Files:      src/clipboard.c, src/mbyte.c, src/register.c


*** ../vim-8.2.2932/src/clipboard.c     2021-01-02 16:53:08.294010035 +0100
--- src/clipboard.c     2021-06-04 17:01:29.353519372 +0200
***************
*** 2090,2096 ****
  
      clip_free_selection(cbd);
  
!     str_to_reg(y_ptr, type, str, len, 0L, FALSE);
  }
  
  /*
--- 2090,2096 ----
  
      clip_free_selection(cbd);
  
!     str_to_reg(y_ptr, type, str, len, -1, FALSE);
  }
  
  /*
*** ../vim-8.2.2932/src/mbyte.c 2021-06-02 13:28:11.431120460 +0200
--- src/mbyte.c 2021-06-04 17:01:29.353519372 +0200
***************
*** 4308,4314 ****
      return count;
  }
  
- #if (defined(FEAT_SPELL) || defined(FEAT_EVAL)) || defined(PROTO)
  /*
   * Like mb_charlen() but for a string with specified length.
   */
--- 4308,4313 ----
***************
*** 4323,4329 ****
  
      return count;
  }
- #endif
  
  /*
   * Try to un-escape a multi-byte character.
--- 4322,4327 ----
*** ../vim-8.2.2932/src/register.c      2021-05-30 22:17:21.035457554 +0200
--- src/register.c      2021-06-04 17:01:29.353519372 +0200
***************
*** 2836,2841 ****
--- 2836,2842 ----
      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;
***************
*** 2894,2915 ****
      {
        for (ss = (char_u **) str; *ss != NULL; ++ss, ++lnum)
        {
            i = (long)STRLEN(*ss);
            pp[lnum] = vim_strnsave(*ss, i);
!           if (i > maxlen)
!               maxlen = i;
        }
      }
      else
      {
        for (start = 0; start < len + extraline; start += i + 1)
        {
            for (i = start; i < len; ++i)       // find the end of the line
                if (str[i] == '\n')
                    break;
            i -= start;                 // i is now length of line
!           if (i > maxlen)
!               maxlen = i;
            if (append)
            {
                --lnum;
--- 2895,2920 ----
      {
        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;
        }
      }
      else
      {
        for (start = 0; start < len + extraline; start += i + 1)
        {
+           charlen = 0;
            for (i = start; i < len; ++i)       // find the end of the line
                if (str[i] == '\n')
                    break;
            i -= start;                 // i is now length of line
!           if (start < len)
!               charlen = mb_charlen_len(str + start, i);
!           if (charlen > maxlen)
!               maxlen = charlen;
            if (append)
            {
                --lnum;
*** ../vim-8.2.2932/src/version.c       2021-06-03 22:11:04.418516318 +0200
--- src/version.c       2021-06-04 17:10:27.524274273 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2933,
  /**/

-- 
"Software is like sex... it's better when it's free."
                -- Linus Torvalds, initiator of the free Linux OS
Makes me wonder what FSF stands for...?

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202106041523.154FNkeA3132137%40masaka.moolenaar.net.

Raspunde prin e-mail lui